How to enable client-side validation for an input field on work object form
Client-side validation ensures that data entry on a work object form is correct before the form is submitted to the application server. For example, if a user enters an incorrect date into a date field (for example 2/30/2007), an error notification appears when the focus exits the date field.
Client-side validation can occur on both a value received from an external system and on a Process Commander property for which users enter data on a form. Enabling client-side validation on a property on a Harness rule requires you to:
- Create a custom edit validate rule (Rule-Edit-Validate rule type). This allows you to define a Java routine that tests the validity of a data entry value.
- Select the Enable Client Side Validation check box on the HTML tab of the Harness forms on which the property requiring validation appears.
Update: Instructions in this article are correct through V54.SP1 only.
For information on creating a Rule-Edit-Validate rule and selecting the Enable Client Side Validation check box, see the Application Developer Help system.
- Add code similar to the following to the File Source section of the new Rule-File-Text instance:
/* IsNotFutureDateTest */
var ruleEditValidate_notFutureDateTest = new validation_ValidationType("notfuturedatetest", ruleEditValidate_isNotFutureDate);
- Add the new Rule-File-Text instance (in this example, pega_validators_Test) to the Scripts section of the Scripts and Styles tab of the Harness form: