Fixed bug in the new portal: the wizard validation was inoperant when several selection lists were proposed

SVN:trunk[1587]
This commit is contained in:
Romain Quetiez
2011-09-20 13:50:11 +00:00
parent 2b1aecda53
commit b46ed4764d

View File

@@ -147,9 +147,18 @@ EOF
$this->add_script( $this->add_script(
<<<EOF <<<EOF
function CheckSelection(sMessage) function CheckSelection(sMessage, sInputId)
{ {
var bResult = ($('input:checked').length > 0); var bResult;
if (sInputId.length > 0)
{
bResult = ($('input[name='+sInputId+']:checked').length > 0);
}
else
{
// First select found...
bResult = ($('input:checked').length > 0);
}
if (!bResult) if (!bResult)
{ {
alert(sMessage); alert(sMessage);
@@ -804,12 +813,12 @@ EOF
} }
} }
public function WizardCheckSelectionOnSubmit($sMessageIfNoSelection) public function WizardCheckSelectionOnSubmit($sMessageIfNoSelection, $sInputName = '')
{ {
$this->add_ready_script( $this->add_ready_script(
<<<EOF <<<EOF
$('#{$this->m_sWizardId}').submit(function() { $('#{$this->m_sWizardId}').submit(function() {
return CheckSelection('$sMessageIfNoSelection'); return CheckSelection('$sMessageIfNoSelection', '$sInputName');
}); });
EOF EOF
); );