Adding Server-side Capabilities to Form Validation with the DOM
Are you looking for a comprehensive guide on how to create a form validation system that uses the DOM for displaying error messages, instead of showing silly alerts? Then this group of three articles (of which this one is the third) may fit your requirements. They're aimed at showing you how to perform client-side validation on your own online forms.
Adding Server-side Capabilities to Form Validation with the DOM (Page 1 of 5 )
Introduction
Despite the fact that checking the validity of data entered in web forms has been covered many times, the introduction of modern techniques of web development, destined to dynamically manipulate the tree of a given web document, opens a brand new range of possibilities for displaying error messages and notices.
Naturally, this ability, which is implemented via JavaScript, requires a stronger background on the Document Object Model, but it doesn’t mean that you have to be a guru on the subject. By using only a few straightforward DOM methods, it’s possible to develop a form validation mechanism like the one described in the two preceding articles without having to use old-fashioned alerts.
I’ve been using this type of script during the development of distinct web applications that only required basic client-side validation on online forms. I've achieved decent results, so naturally I thought the experience itself deserved an in-depth look. Keeping this in mind, in the two previous articles of the series I explained how to create a simple form validation mechanism which utilizes the DOM to display the corresponding error messages.
However, due to the fact that any robust form checking application must be founded on the capabilities offered by server-side validation, in this final part of the series I’ll show you how to integrate the existing client-side script with a handy form verification class, developed with PHP 5. Hopefully, the correct integration of both client and server modules should result in the implementation of a robust mechanism, handy for verifying the validity of all the data entered into web forms.
Having defined the subject of this concluding tutorial, let’s move on and learn together how to add server-side validation capabilities to the original client script. Let’s go!