Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Designing a modal validation error message on a read-only property

Updated on October 2, 2015

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.

Explanation

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.

Error

Validation errors for read-only properties display as page-level errors instead of modal dialog boxes for the properties.

Suggested approach

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
(tools.getActiveValue()));%></span>

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".

Voting record on Amendments, Proposition 4, user-entered text "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 OK to submit the form, the following error message is displayed:

Since aBoolean is true, this property must have a value of "yes" or "no".

Since aBoolean is true, this property must have a value of "yes" or "no".

To correct the validation error, the user must click Cancel 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:

Cell properties with internal control ValueWithMessages for Property .aTextProp2, Visibility Always, Disable Never

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us