JavaScript Form Validation Framework

The JavaScript code is freely available for download on code.google.com/p/javascriptformvalidation/
Home | Download | Demo | Instructions | Why use JavaScript Form Field Validation? | How can you help? | Members

Form Field Validation Demos

  1. Basic form field validation
  2. Form field validation with custom error
  3. Form field validation with custom error handler
  4. Form field validation with XML file as definition or also known as AJAX Form Validation

The following demonstrates how you validate a form field and process the error with a custom error handler.

Business name

Postcode

See the form validation demo on its own


The code below can be copied and pasted on your own page for testing and should work as is.

Please note that we have limited the demo to two form fields to keep it readable.

Note that the Property object gets passed in a reference to a custom error handler.

This error handler receives a reference to the Property object itself which allows us to work with the information in the form field.

On line 2 the custom error handler expects an HTML element with id "businessNameContainerMessage" to be present, where "businessName" is the name that matches the form field and the same goes for "businessNameContainerMessage" on line 3.

On line 4 the error message gets inserted in the message container, and on line 5 the CSS class is changed so that the style of the error area changes.


Comments

There are no comments at the moment, be the first to leave a comment!

Comments are moderated

Leave a comment on this page, feedback or code improvement

yes no

http://

yes no

Sponsored by clickfind - Advertise your Business online

About us | Advertise online | Add my business | Contact us | Search engine reports | Site map | News media
Business directory | Article directory | Get driving directions | Developers directory Form Validation | Our blog
Terms & conditions | Privacy policy | Refund policy | © 2012 clickfind Pty Ltd
conversion optimization