A field can be marked valid or invalid via Custom JavaScript. Setting a field invalid will prevent the form from being submitted. An invalid message can be setup to show below the field when the field is marked invalid.
(Note: A field has to be dirty for the validation message to show.)
...
Visit the Field List within the module for which the form field is to be made valid/invalid.
To setup a validation message, the following JavaScript must be executed in the form field on Init/Blur.
fieldScope.addValidationMessage("MyValidationName", "My test validation");The method 'addValidationMessage' on the fieldScope takes a key for the validation and a corresponding message.
Review the form to ensure the Message and field reflect the validation applied through the Custom JavaScript.
...
Tip: It’s useful to use these within Conditional Statements to apply Valid/Invalid message accordingly.
...
Info |
---|
Marking a field as invalid/valid To mark a field as valid / invalid use the following JavaScript code. //to set the field to be invalid. fieldScope.setValidity('MyValidationName', false) //to set the field to be valid. |
Info |
---|
Marking another field on the form as invalid/valid To mark a field other than the one referenced by the fieldScope, use the following JavaScript code. //to mark another field invalid. $scope.setFieldValidity(<display name of the other field>, 'MyValidationName', false); //to mark another field valid. $scope.setFieldValidity(<display name of the other field>, 'MyValidationName', true); |
Page Properties | ||
---|---|---|
| ||
|