浏览代码

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1587 a333f486-631f-4898-b8df-5754b55c2be0
romainq 14 年之前
父节点
当前提交
e44fe13993
共有 1 个文件被更改,包括 13 次插入4 次删除
  1. 13 4
      application/portalwebpage.class.inc.php

+ 13 - 4
application/portalwebpage.class.inc.php

@@ -147,9 +147,18 @@ EOF
 
 	$this->add_script(
 <<<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)
 		{
 			alert(sMessage);
@@ -804,12 +813,12 @@ EOF
 		}
 	}
 
-	public function WizardCheckSelectionOnSubmit($sMessageIfNoSelection)
+	public function WizardCheckSelectionOnSubmit($sMessageIfNoSelection, $sInputName = '')
 	{
 		$this->add_ready_script(
 <<<EOF
 	$('#{$this->m_sWizardId}').submit(function() {
-		return CheckSelection('$sMessageIfNoSelection');
+		return CheckSelection('$sMessageIfNoSelection', '$sInputName');
 	});
 EOF
 		);