4.17.
4.5 Creating a Form Validation Ajax Application 83
Fig. 4.17 Running Form Validation GWT Application
The HTML host page gets displayed. The HTML host page consists of
a table containing rows for input values for a catalog entry and a Submit
button as shown in Fig. 4.18.
Fig. 4.18 Input Form for creating a Catalog Entry
84 4 Ajax with Java-GWT
Start to specify a value for the Catalog ID field. An Ajax request gets
initiated and the Catalog ID value gets validated with catalog entries in a
HashMap. A validation message indicates the validity of the Catalog ID
value as shown in Fig. 4.19.
Fig. 4.19 Validating Catalog Id
An Ajax request is sent as each character is added to the Catalog ID
field and the validation message displayed. If a Catalog ID value is
specified that is already in the HashMap, catalog1 for example, a
validation message: ???Catalog Id is not Valid???. The form fields get filled for
the catalog entry and the Submit button gets disabled as shown in Fig.
4.20.
4.5 Creating a Form Validation Ajax Application 85
Fig. 4.20 Non Valid Catalog Id
If a Catalog ID is specified that is not already in the HashMap, a
validation message gets displayed, ???Catalog Id is valid???. The form fields
get set to empty fields and the Submit button gets enabled. Specify values
for a catalog entry and click on the Submit button as shown in Fig. 4.21. A
new catalog entry gets created in the HashMap.
Pages:
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91