Java Reference
In-Depth Information
Once we have the
Alert
component on the page, we need to set the
notify
attribute
of the text field to be validated to be the component id of the alert component.
In our example, we modified the default
id
attribute of the alert component to
be
autoValidateAlert
. Since it is placed inside a
Form
component with an
id of
form1
, and
Form
is a naming container, the full id of our alert is
form1:
autoValidateAlert
.
The
notify
attribute of the
Text Field
component is not shown on the
Properties
window; we need to modify the JSP source to add it. In the JSP source, we
should look for a
<webuijsf:textField>
component with an
id
attribute of
firstNameField
, and add the full id of the alert component as its value.
<webuijsf:textField autoValidate="true" columns="10"
id="firstNameField" label="First Name"
required="true"
notify="form1:autoValidateAlert"/>
For clarity, additional attributes that are irrelevant to the discussion at
hand were removed from the above code snippet.