Back Forward More about Edit Validate rules

About Edit Validate rules

Cannot validate empty input fields

If an input field is blank, the edit validate rule associated with the property is not called. You can't create an edit validate rule that checks whether a value is empty. B-19839 Rejected

Comparing edit validate and constraints rules

Constraints rules provide a useful alternative to edit validate rules, especially for properties that may be updated both by computations and by direct user input.

Comparing edit validate rules and edit input rules

Don't confuse edit validate processing with edit input processing:

The property value (stored in the variable theValue) that is input to edit validate processing may not be what the user typed, if an edit input transformation is associated with the property.

Use of regular expressions

You can create edit validate rules that use regular expression pattern matching to validate user inputs. See Pega Developer Network article PDNPRKB-24112 How to use regular expressions to validate user input.

Client-side validation

Advanced featureThe standard text file rule named webwb.pega_validators.js includes JavaScript functions that exactly emulate a few standard edit validate rules. When enabled appropriately, these JavaScript functions are incorporated into work object forms and flow actions, supporting client-side validation of user inputs, before a user submits the form.

If desired, you can build a similar capability for an edit validate rule in your application RuleSet. JavaScript skills are required. C-1197

  1. Create and test the edit validate rule.
  2. Associate an edit validate rule with a property.
  3. Create and test a JavaScript function that performs the same validation test as the edit validate rule, and has the same name. Follow the structure used in the standard text file rule webwb.pega_validators.js
  4. Save the JavaScript in a text file rule in your application RuleSet.
  5. Associate with the property an control rule that includes the ClientValidation control rule.
  6. Enable client-side validation, by a checkbox on the HTML tab of the Flow Action form or Harness form. For best results use JSP tags and the SmartFrames format for the harness rule.
  7. Reference the text file rule containing the JavaScript function on the Scripts and Styles tab of each harness rule that can present the field as an input field, that is, in read-write mode.
  8. Test.

Message rule

When an input value fails validation by an edit validate rule, the system adds the message rule named PropertyInfo-EditValidate to the property. The default text is

Invalid value specified for {1}.

where {1} identifies the property. CLINB 10/14/06 clinic

Java code display

When you save an edit validate rule, the system converts the rule to Java source code. As a learning or debugging aid, you can review this Java code.

C-1665Click the Show Java toolbar button (Show Java) to see the system-generated Java code that implements the rule. The window presents a read-only preview of the Java that implements this rule instance. This Java code is not identical to the Java that is executed at runtime, which includes Java code inlined from other rule instances and reflects rules in the requestor's RuleSet list.

Definitions client-side format validation
Related topics Property-Validate method
Standard rules Atlas — Standard Edit Validate rules

UpAbout Edit Validate rules