Versions Compared

Key

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

WebWork adds support for client-side validation on top of XWork's standard validation framework. You It can enable it be enabled on a per-form basis by specifying validate="true" in the form tag:

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

You must specify a name for the form in order for client-side validation.

Note

A name for the form can be supplied, else the action name will be used as the form name.

A You should also make sure you provide the correct action and namespace attributes must be provided to the <ww:form> tag. For example, if you have an the Action named "submitProfile" is used in the "/user" namespace, you must usethe following must be used.

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

...

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

Of course, all All the standard validation configuration steps still apply. Client-side validation uses the same validation rules as server-side validation. If server-side validation doesn't work, then client-side validation won't work either.

Note

(info) Not all validators support client-side validation. Currently only the followings validators supports client-side validation (xhtml theme).

  1. required validator
  2. requiredstring validator
  3. email validator
  4. url validator
  5. int validator

...