March 8, 2005
Dispatch war rocket Ajax...
Everybody is making a big noise about it now that it has a name, or rather an acronym. It's AJAX baby, no longer DOM ECMAScript with asynchronous utilisation of the XMLHTTPRequest ActiveX thingumajig yokey....
AJAX, its great. The name focuses thoughts about what it is, makes it acceptable instead of completely cutting edge and means that people will likely be using it more and more.
The first use, and to me the most obvious, is for form validation. Mix up a contact form for instance, add a little AJAX and you have a pretty accessible method for doing form validation.
Use pure AJAX on browsers that grok it, sending requests to the same script that will process the full form to check the content of each field as it looses focus - you could even do an on the fly validation of email or credit card numbers. The ECMA Script could handle the usual denial of submission should any of the fields still fail validation.
The approach rocks.
If the browser doesnt handle the girth and length of AJAX, or even ECMA Script then the server script will handle it all.
Needs a bit more programming to make it all work - you need to return the errors to the browser - but this could be done by using the LWP module in Perl or something similar in your scripting language of choice and parsing the HTML page with the form, using the ID's as hooks (remember we will be parsing proper XHTML here...) for where the errors will be printed out and the information slotted back in.
All nice and neat, one script for the front-end and one for the backend which together cover every need for validation of the form.
Ajax was a warrior with the Trojans, I think his namesake has the same potential to lay waste to all problems before it.
Posted by dottie at 3:36 PM | Comments (0)