Script for validating online forms
When all fields have been validated the form will be able to be submitted.Samples of the XML files returned in each case can be found below.But you still have to cater for (or choose to exclude) non-compatible browsers. I have looked all over the web to find a great script already made to download- but your tutorial is very close to what is have been looking for- Thanks for taking the time to explain- I see that you are using it also for your comment/feedback box..On the page "Java Script: Form Validation using Ajax", section 5 ("Putting it all together"), the last paragraph states that "The other two files (represented in the graphic in green) can be downloaded or copied from this site and included from your files as indicated.". The rollover top navigation is nice too- Never saw anything like that before- almost like flash- well i am going to try to replicate your code- add more fields to it- I am more interested in date validation-if i have a problem- i will come back here !!A couple of people have already asked for a copy of the script referred to in these examples.My feeling is that this article already describes how to generate the XMLHttp Request (Ajax) request, passing GET or POST variables to a server-side script using our Java Script class, and the related article referred to above provides a complementary PHP class for generating XML responses, so really all that's left is basic programming to process the incoming variables and generate the relevant XML response.The target value is also used to work out the id of the relevant checkbox and the DIV that will display feedback.
A few people have commented that this is all a bit confusing when it comes to implementing it on your own website.
If you want to do a calculation that can only be done server-side (eg.
checking that a username is unique in your database) or you want to update the DOM with data from another script or site then Ajax is the perfect tool.
The other two files (represented in the graphic in green) can be downloaded or copied from this site and included from your files as indicated.
In this particular example, and with form validation in general, the advantage over other techniques (Java Script and/or server-side validation) is that we can make use of server-side technologies to perform more complex validation and present real-time feedback to the user without reloading the page.