Validating fields with the web UI framework
You can validate fields against certain standards, using the default validation system or your own validation system.
About this task
The
Web UI Framework provides validation for the following three types
of information in the en_US locale:
- E-mail address (using the international accepted standard)
- Telephone number format (locale-specific)
- Credit card number (using the Luhn algorithm)
To validate items, do the following:
Procedure
Results
The following is an example of how to add validation for a last name:
sc.plat.ValidateUtils.registerValidator('LastName', function (value){
if (value == null || value.length<2) {
return {status: 2,message: "Last name needs at least two characters" };
}
return {status: 1};
});