Thu 12th March 2009
|
Apologies if the website I'm now going to mention is well known among you all but I've only today stumbled across it.
I decided today to have a look at live form validation, you know the thing; when signing up on some websites they have a system where every entry you type into an input box gets validated immediately.
I thought that was pretty cool so thought I'd work it out and stick it on my Contact page. During my Google research, I came across LiveValidation, a small piece of Javascript designed for the very purpose of on-the-fly form validation.
Brilliant!
It's extremely easy to use - just include the javascript class somewhere on your page and then add the validation code after each form component. LiveValidation literally does the rest for you (as long as each input field has an "id" identifier). After tweaking it to my liking I now have a very nice looking validation component on my own Contact page.
I've you're good with PHP, it's well worth remembering to insert some server-side validation also. This allows browsers that are not running Javascript to still complete your forms. This also allows for anyone attempting to bypass the Javascript to still come up against validation.
Now, my Contact form is validated first by the LiveValidation script, then assuming this is all OK the server validates the entires also using PHP, assuming this is OK the message gets delivered. An additional layer of spam protection plus it looks good too!
If you're interested, head on over to the LiveValidation site to download their Javascript code. |
|
|