Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
html
html
<ww:form name="'test'" action="'javascriptValidation'" validate="true">

  ...
</ww:form>

Of course, all the standard validation configuration steps still apply. Client-side validation uses the same validation rules as server-side validation. That said, there are some caveats to using client-side validation:

  • You must use the <ww:form> tag
  • You must provide the correct "action" and "namespace" attributes to the <ww:form> tag

For example, if you have an Action named "submitProfile" in the "/user" namespace, you must use

Code Block
html
html

<ww:form namespace="'/user'" action="'submitProfile'" validate="true">
  ...
</ww:form>

While the following will "work" in the sense that the form will function correctly, client-side validation will not:

Code Block
html
html

<ww:form action="'/user/submitProfile.action'" validate="true">
  ...
</ww:form>


(info) Note that the "required" attribute on many WebWork UI tags has nothing to do with client-side validation.
(warning) 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.

...