{dialog.object}clientSideValidateField Method
Syntax
{dialog.object}.clientSideValidateField(colName [, rowNum [, instNum]]);
Arguments
- colNameString
The name of the UX control to validate.
- rowNumNumber
Default = 1. The row number. In a UX Component, the row number is always '1'. Always pass in a value of 1 when calling this method in a UX.
- instNumNumber
Default = 0. The Repeating Section instance number for the control. This argument is required if the control is in a Repeating Section.
Returns
- resultstring
If there are no errors, returns a blank string. If there are errors, returns the error message.
Description
Executes client-side validation for a control in the UX Component.
Discussion
The {dialog.object}.clientSideValidateField() method executes client-side validation rules for a control in the UX Component. This method can be used to evaluate the client-side rules on demand using JavaScript. For example:
var controlsToValidate = ['TXT1','TXT2','TXT3']; var flagHasError = false; var result = ''; for(var i = 0; i < controlsToValidate.length; i++) { result = {dialog.object}.clientSideValidateField(controlsToValidate[i]); if(result != '') { flagHasError = true; } } if(!flagHasError) {dialog.object}.panelSetActive('PANELCARD_2');
To learn more, watch the video below.
Executing Client-side Validation Rules Programmatically
When you define validation rules for controls in a UX component, the rule are evaluated when the data is submitted. There are instances where you need to evaluate the validation rules for a set of controls on demand. For example, before navigating to a new Panel Card.
This video demonstrates how to use the {dialog.object}.clientSideValidateField() method to execute client-side validation rules for a set of text boxes when the user tries to navigate to a new Panel Card.