Java Reference
In-Depth Information
Figure 15.15:
The state of the contact form after entering some values
The form in Figure
15.15
shows the state after the user has typed some-
thing in. Notice that the “Last name” field is now in error; it is optional,
but with a minimum length of 2. Therefore, entering a single character
is not valid, and the field is in error.
phone number field is not in error despite the input being invalid. That's
because we're using our own custom type converter, which the plug-in
doesn't recognize. You'll also notice that the
Cancel
button is disabled
even though it is associated with a
@DontValidate
event handler in the
action bean.
These limitations very well may have been resolved by the time you read
You can also pass options to the
applyStripesValidation
( ) function to cus-
tomize the behavior of the plug-in. For example, we can tell the plug-in
not to disable buttons. At the same time, we can specify the
error
CSS
class so that it matches the one used by Stripes:
var options = {
invalidClass: 'error',
disableSubmit: false
};
applyStripesValidation('${fmd.formId}', ${fmd}, options);
The form is still validated on the client side when the user submits the
form. The buttons are enabled, and a pop-up message appears if the
on the next page.
Search WWH ::
Custom Search