...
Code Block | ||||
---|---|---|---|---|
| ||||
<ww:form name="'test'" action="'javascriptValidation'" validate="true"> ... </ww:form> |
The parameter required="true" for the previously included JavaScriptRequired validator must be applied to the tag
you want to validate with JavaScript:
...
<ww:textfield label="'Required String'" name="'requiredString'" required="true"/>
Of course, all the standard validation configuration steps still apply. Enabling Client-side validation uses the same validation rules as server-side validation.
Note that the "required" attribute on many WebWork UI tags has nothing to do with client-side validation will produce (harmless) scripting errors if not configured properly.
Upgrade Alert:
...
This feature was introduced in WebWork 2.1. If upgrading from a previous version, make sure you
...
are using the correct validators in validators.xml. You must be using the com.opensymphony.webwork.validators.JavaScriptRequired*Validator version of the standard XWork validators.
Building a Validator that supports client-side validation
...