Home

 

Add simple validation

JSF offers a framework for performing validation on input fields such as required values, validation on the length of the input, and input check for all alphabetic or digits. You can also define your custom validations.

To add simple validation to an input field, do these steps:

Select the Input component {SSN} in the Design tab.

In the Properties view for the input component. Enter the following items in the Validation tab:

Select Value is required.
Select Display validation error message in an error message control. When you select this check box an error message component is added next to the Input box.
Enter 11 in the Minimum and Maximum length fields.

Make the {Error Message for ssn1} component red.

Note: If we do not add an error message field for an input field, messages are displayed automatically in the {Error Messages} field for the whole page.

ibm.com/redbooks