This post originated from an RSS feed registered with Java Buzz
by Goldy Lukka.
Original Post: Realtime Form Validation Using AJAX
Feed Title: Xyling Java Blogs
Feed URL: http://www.javablogs.xyling.com/thisWeek.rss
Feed Description: Your one stop source for Java Related Resources.
Short Description: An article (available by clicking on the title of this post) about real time form validation using AJAX technology. Includes code sample using Java/J2EE.
More information: If you've ever entered form data on the Internet, you've likely encountered cases where server-side processing is used to validate that the data meets a specified set of criteria. JavaScript may be used on the client-side to validate the format of simple data such as email addresses, phone numbers, dates, or credit card numbers. However, client-side processing is limited in that it cannot apply business rules or access server-side data sources to perform that validation.
Consider some of the following use-cases:
You need to validate whether a user name has already been registered when creating an online account
You need to validate a serial number or coupon code that requires special business logic
You need to validate data in conjunction with real-time data that exists on the server or database
Traditional web applications require that the form data be posted to the server. This is followed by some sort of back-end processing of that data, and finally an HTML page refresh that yields the results of the post. However, this strategy can be distracting to the end user, especially in cases where a single form field is invalid and the user has to re-enter a large set of form data.
Using Asynchronous JavaScript and XML (AJAX) interactions, data may be validated in near real-time as the user types the data in an HTML form. In this case, form data is validated asynchronously, which allows the HTML page to continue processing events while the form data is being validated by a server-side component in the background. If the form data does not match what is required by the server-side logic, the user knows immediately and can change it without having to refresh the HTML page.
This article (Refere title of this post) is taken from the The Java BluePrints Solutions Catalog, a new project from the Java BluePrints program. The Java BluePrints program consists of a set of guidelines and best practices, as well as small applications to illustrate these guidelines on both the J2EE 1.4 and 1.5 platforms.