Design an activity that calls a Validate rule, which displays error messages in modal dialog boxes. If the property being validated is read-only, then the validation error message does not display in the modal dialog box, displaying in the primary work form page instead. In this instance, the validation error for the read-only property displays as a page-level message.
By design, read-only properties cannot display property-level error messages next to the property in a modal dialog box as seen with editable properties.
You can work around this limitation by adding an invisible property using the ValueWithMessages control to specify an error message for the read-only property.
Validation errors for read-only properties display as page-level errors instead of modal dialog boxes for the properties.
To ensure that validation errors for the read-only properties display in modal dialog boxes for the properties and not in the primary work form page as page-level error messages, use the internal control ValueWithMessages.
<span><pega:include name="Messages"/><%tools.appendString(StringUtils.crossScriptingFilter<br />
In the following example of a voting application, a modal window pops up displaying text that the user has entered in response to Proposition 4, "present".
Normally the user can enter “yes”, “no”, or “present”. However, the moderator can force the voter to vote “yes” or “no” and eliminate “present” as a valid value.
As the application developer, you achieve this by setting another property, called aBoolean, to “true”. For this example, aBoolean is true; therefore, the value “present” is an invalid choice. Remember that this modal window is completely read-only: The user entered “present” on a previous form.
The value of “present” is read-only and — based upon the setting of aBoolean — is an invalid value for the property.
If the user clicks
to submit the form, the following error message is displayed:
Since aBoolean is true, this property must have a value of "yes" or "no".
To correct the validation error, the user must click
and change “present” to be either “true” or “false”.
As the application developer, you design the section that displays this modal dialog box as shown in the following screen.
The property panel for the Boolean (true/false) property called aTextProp2 uses the control ValueWithMessageswith Visibility set to Always and Disable set to Never: