WebWork The framework adds support for client-side validation on top of XWork's the standard validation framework.
Client-side validation can be enabled You can enable it on a per-form basis by specifying validate="true"
in the form tag:.
Code Block | ||||
---|---|---|---|---|
| ||||
<ww<s:form name="'test'" action="'javascriptValidation'" validate="true"> ... </wws:form> |
You must specify If a name
for the form in order for client-side validation.You should also make sure you provide the is not given, the action mapping name will be used as the form name. Otherwise, a correct action
and namespace
attributes must be provided to the <ww <saf:form>
tag. For example, if you have an Action named
Code Block | ||||||
---|---|---|---|---|---|---|
|
...
<s | ||
Code Block | ||
---|---|---|
html | html | <ww:form namespace="'/user'" action="'submitProfile'" validate="true"> ... </wws:form> |
While the following will "work" in the sense that the form will function correctlyTechnically, the form's action attribute can refer to a "path" that includes the namespace and action as a URI. But, client-side validation will not: requires that the action name and namespeact to be set separately.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<s <ww:form action="'/user/submitProfile.action'" validate="true"> ... </wws:form> |
Of course, all the standard All the usual validation configuration steps still apply to client-side validation. 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.
Info |
---|
Note |
---|
Not all validators support client-side validation. Currently only the followings validators supports client-side validation.
|
| ||
The | ||
Note | ||
---|---|---|
Note that the |
Building a Validator that supports client-side validation
...
') next to the field. The tag doesn't know if the validation system actually "requires" the field or not. |
Client Side Validation Types
There are two styles of client side validation.
Used by the xhtml theme and css_xhtml theme | |
Used by the ajax theme |