Quellcode durchsuchen

A mandatory case log field is now considered as 'filled' if it contains a previous entry

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1468 a333f486-631f-4898-b8df-5754b55c2be0
dflaven vor 14 Jahren
Ursprung
Commit
54824742de
1 geänderte Dateien mit 29 neuen und 0 gelöschten Zeilen
  1. 29 0
      js/forms-json-utils.js

+ 29 - 0
js/forms-json-utils.js

@@ -295,6 +295,35 @@ function ValidatePasswordField(id, sFormId)
 	return true;
 }
 
+//Special validation function for case log fields, taking into account the history
+// to determine if the field is empty or not
+function ValidateCaseLogField(sFieldId, bMandatory, sFormId)
+{
+	bValid = true;
+	
+	if ($('#'+sFieldId).attr('disabled'))
+	{
+		bValid = true; // disabled fields are not checked
+	}
+	else if (!bMandatory)
+	{
+		bValid = true;
+	}
+	else
+	{
+		if (bMandatory)
+		{
+			var count = $('#'+sFieldId+'_count').val();
+			if ( (count == 0) && ($('#'+sFieldId).val() == '') )
+			{
+				// No previous entry and no content typed
+				bValid = false;
+			}
+		}
+	}
+	ReportFieldValidationStatus(sFieldId, sFormId, bValid);
+	return bValid;
+}
 // Manage a 'duration' field
 function UpdateDuration(iId)
 {