Creating and using a validate rule
Validate rules (Rule-Obj-Validate rule type) help a user enter valid property values into an HTML form or to validate data received from another source. A validate rule can test input values against edits defined in edit validate rules for properties. When a property value does not pass the tests, Process Commander adds one or more messages to the clipboard page containing these values, marking the page as invalid.
To create a validate rule:
- From the Rules by Type explorer, select Process > Validate.
- Click the New button. The New Validate Rule dialog box appears.
- In the Validate Name field, enter the name of the validate rule. Choose the appropriate RuleSet and Version Number and click Create.
On the Validate tab you can create a validation that tests the validity of a property value entered by a user or to test the validity of data received from another source.
To create a validation entry click the Validate field and choose validate, validate each, call, or call for each. See the examples below for more information on using a validate rule.
Validate or Validate Each
By choosing validate or validate each, you are directly validating a top level property or an embedded property. After choosing which way to validate, select the Property field and choose a property to validate from the SmartPrompt.
By checking the Required? checkbox, you can require that the property being validated must not be blank. By checking the Conditions? checkbox, you can create an expression to validate the property against.
To determine the conditions of the of the validation, select the Expression field.
By clicking on the drop-down button, you can select from a list of different expression types. Depending on the expression type you choose, you will input various properties or values.
In the Message field you can select a Rule-Message key from the SmartPrompt to associate with the property or you may also type your own message, using quotation marks. This text is not used when the Required? box is selected.
By checking the Continue? checkbox, other properties will be validated even if this validation fails.
Call or Call for Each
If you choose call or call for each, you will call another validate rule or call another validate record on an embedded page.
Next, choose a step page to call a validate rule against. Then select a validate rule to run against the step page that was chosen using the SmartPrompt.
You want to validate that if the style of a vehicle is a sedan, then the color of the vehicle cannot be red. The first step is to validate the property .Vehicle().Color (Figure 1).
Next, you have to create the conditions for the validation to activate. In this case if the style of the vehicle is a sedan and the color of the vehicle is red the validation will activate (Figure 2).
The final step is adding a message to the validation if it fails. If the style of the vehicle is a sedan and the color is red, the validation will activate and display a message stating that a sedan cannot be red (Figure 3).
Example: Validating a Step Page Using the Call Option
You want to call a step page and run a validate rule. The first step is set the validate type to Call (Figure 1).
Next, you have to set the step page to run the validate rule you will be calling against (Figure 2)
The final step is adding the validate rule to run against the step page in question(Figure 3).