Validating form fields with ajax
In this article, you'll learn how to create a Web application using Ajax in Oracle JDeveloper 10 (10.1.3). As a J2EE developer, you're probably familiar with DOM and Java Script, but not necessarily so with XMLHttp Request.In Ajax, the XMLHttp Request object is what provides the asynchronous communication between Web applications and underlying servers and business services.I've used this PHP/AJAX method of validation for a bit, but I think it could use a little peer review.The basic idea was to create a way of verifying forms in a nice manor using AJAX, but also fall-back to PHP when the user disables Java Script.Originally introduced by Microsoft as an Active X component, XMLHttp Request is now supported by most modern browsers.AJAX (Asynchronous Java Script and XML) is the art of exchanging data with a server, and updating parts of a web page – without reloading the whole page. We have already explained about form validation using different technologies.Now, the same can be done by using Ajax, In this blog post we will tell you how it can be done.
Samples of the XML files returned in each case can be found below.
A random function should not be responsible for setting up a DB connection. Make it a function and it will go a long way towards cleaning this up.
I'm still not thrilled with the extra large switch statement and would suggest making the code in each of those cases their own function.
The to the input box ('email'), to the associated checkbox ('valid_email) and to the DIV where the feedback text is to appear ('rsp_email').
These elements can then be referenced in the XML file that is returned by the Ajax call.
Search for validating form fields with ajax:
With Ajax, the data added to the form can be dynamically validated as the data is added to form fields using business logic in a server application.