Java Reference
In-Depth Information
At the time of writing, there was an issue which caused the
Drop Down
List
and
Button
components not to align properly with other components
in some situations (they align properly in the design window, but don't
align properly on the rendered page). We confess, we moved these
components as appropriate before taking each screenshot. We expect the
issue to be fixed before publication.
Ajax Autovalidation
Another way we can validate our text fields is by using the built-in Ajax enabled
autovalidation. This approach allows us to validate user input as soon as the text
field loses focus, providing instant feedback to the user. In order to do this, we need
to set the
autoValidate
attribute of the text field to "true". The easiest way to do this
is to click on the checkbox next to this attribute in the
Properties
window.
At this point, the text field will be validated as soon as it loses focus by triggering
an Ajax request to the server. If validation fails, the text field's component will turn
red, but no error message will be displayed. In order to display an error message, we
need to add an
Alert
component to the page.