Skip to main content

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

validate(value, propertyName)

Updated on July 20, 2021

Validates the specified field and updates the state if the validation is successful.

Note: You must update to Pega 8.7.2 or later patches to be able to use this API.

The validation status is passed to the component through the validatemessage prop parameter. If the validation is successful, an empty string is returned. If the validation fails, the validatemessage prop parameter contains the error message.

In addition to directly invoking the validate(value, propertyName) API, the field is validated automatically when the onBlur and/or onChange callbacks provided in the component prop parameter are invoked. These callbacks are either passed to the display component or called from the DX component.

Use the following code in the DX component for automatic validation where the display component invokes the callbacks provided in the props:

const {label, required, validatemessage, status, onChange, onBlur, readOnly, testId} = props;


There are two types of client validations:

  • Required - This validation prevents submitting empty fields.
  • Type - This validates the field based on its type.

    The following type validators are supported:

    • alpha
    • alphaNumeric
    • alphaNumericWithSpace
    • datetime
    • email
    • futureDate
    • integer
    • nonNegative
    • nonNegativeInteger
    • notFutureDate
    • phone
    • posDecimal
    • required
    • urgencyValue
    • url
    • validators
    • validPhoneNumber


An object containing the validation status.

  • If the field is successfully validated, the object will contain the validation status as true.
  • If the field fails the validation, the object will contain an error message and the validation status as false.


valuestringThe value of the field to be validated.
propertyNamestringThe name of the field to be validated.
Note: If propertyName is not provided, the default value is obtained from the Redux state.

Usage example

In this example, the API returns an object that contains the validation status as false and an error message that conveys that the entered email address is invalid.

pConnect.getValidationApi().validate('', '.email');

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. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us