2.15.
Fig. 2.15 Dynamic Validation
If a value is added that is already defined in the database, a ???Catalog Id
is not Valid??? message gets displayed and the Submit button gets disabled
as shown in Fig. 2.16.
42 2 Developing an Ajax Web Application
Fig. 2.16 Non-Valid Catalog Id
Specify a Catalog Id field value that is valid and click on Create
Catalog button to add a catalog entry as shown in Fig. 2.17.
Fig. 2.17 Creating a Catalog Entry for a Valid Catalog Id
2.5 Summary 43
The form gets posted to the server with POST method, because the
method specified in
element is POST. A catalog entry for the
specified field values gets added to the database. If subsequently, a Catalog
Id value of Catalog4 is re-specified, an XMLHttpRequest gets sent to
the server, and the response has
element set to false. The
validation message gets displayed to indicate that the Catalog Id is not
valid as shown in Fig. 2.18.
Fig. 2.18 A Catalog Id becomes non-valid after a catalog entry is created
2.5 Summary
The Ajax technique provides dynamic validation of data added to an input
form using the XMLHttpRequest object. Ajax is a technique, therefore
a combination other than JavaScript, DOM and Servlet may be used. For
example, the server side application may be a PHP script instead of a
servlet. In this chapter we used Ajax to validate an input form in
JDeveloper 11g. HTTP Servlet is used on the server side.
Pages:
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60