Validators can implement WebWork adds support for client-side validation on top of XWork's standard validation framework. Any validator can be extended to support client-side validation by implementing the com.opensymphony.webwork.validators.ScriptValidationAware interface to provide support for client-side validation:
Code Block |
---|
public interface ScriptValidationAware extends FieldValidator { public String validationScript(Map parameters); } |
...
To enable client-side validation, use , first make sure you have defined the correct validators in validators.xml. You must be using the com.opensymphony.webwork.validators.JavaScriptRequired*Validator instead of the standard XWork validators. Then, when you specify the <ww:form> tag, add validate="true":
Code Block | ||||
---|---|---|---|---|
| ||||
<ww:form name="'test'" action="'javascriptValidation'" validate="true" > ... </ww:form> |
...