Setting Up Field Validation

You can improve Webform effectiveness with client side field validation in your custom Webforms.

Webform text fields support field validation through regular expression testing, which allows the designer to specify a pattern that a document or form field must match. If the field does not match the pattern, an error dialog box is displayed and the input focus is set to the field in error. The designer can optionally specify the message to be displayed, or a generic default message is used. The associated field definition properties are:

For example, your error message might be "The text you entered in the {0} field is invalid.".
Note: Place error messages in message files, not directly in the property value. For example, to explicitly reference the default message, the value of the validateErrorMsg property would be !py:webformsUtil.getNoArgMsg('fieldInvalid')

For details on javascript commands, see Using javascript.

For details on javascript regular expressions, consult a reference on JavaScript. One source on the web is:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/jscript7/html/jsjsgrpregexpsyntax.asp

Additional sample patterns: