When we surf in internet, we are often asked to filled in a form. The most important aspects of building and processing a form is how the form validates data, helps the visitor with tips, how to make it easy to understand what’s required and optional and how it performs after hitting the submit button. If form validation does not work well, most of the us will leave the site.

Below collected examples will be useful stuff in helping you learn how to create a form that will process and validate inputs using AJAX.

ajax form validation 

Roscripts Ajax Form Validation

This example is a registration page which will do nothing after validation but show errors or a success message.

www.donotyet.com_Roscripts Ajax Form Validation

Demo Demo Download Download

Using Ajax to Validate Forms

This shows two examples of client side validation in a form using JavaScript (with jQuery). The username will check with the server whether the chosen name is valid and available. The avatar example tries to load the URL in to a hidden image, if it fails, it shows the appropriate message.

www.donotyet.com_jqueryfordesigners form validation

Demo Demo Download Download

Packtpub AJAX Form Validation

This form validation application validates a registration form, using both AJAX validation (client side) and typical server-side validation:

AJAX-style (on the client), when each form field loses focus (onblur). The field’s value is sent to the server, which validates the data and returns a result (0 for failure, 1 for success). If validation fails, an error message will unobtrusively show up and notify the user about the failed validation.
PHP-style (on the server), when the entire form is submitted. This is the usual validation you would do on the server, by checking user input against certain rules. If no errors are found and the input data is valid, the browser is redirected to a success page. If validation fails, however, the user is sent back to the form page with the invalid fields highlighted.

www.donotyet.com_nexcess form validation

Demo Demo Download Download

fValidator

Nowadays everybody knows that javascript can be used to validate input data in HTML forms before sending off the content to a server. Despite of that, when there are many fields in the form, the JavaScript validation becomes too complex and boring to code. That’s why fValidator exists, with it form validations are many times easier.

www.donotyet.com_lojcomm form validation

Demo Demo Download Download

jQuery plugin: Validation

There are a lot of non-jQuery-based solutions (which you’d avoid since you found jQuery) and some jQuery-based solutions. This particular one you are looking at is one of the oldest jQuery plugins (started in July 2006) and proved itself in projects all around the world. There is also an article discussing how this plugin fits the bill of the should-be validation solution.

www.donotyet.com_bassistance form validation

Demo Demo Download Download

LiveValidation

The LiveValidation class sets up a text, checkbox, file, or password input, or a textarea to allow its value to be validated in real-time based upon the validations you assign to it.

www.donotyet.com_livevalidation form validation.png

Demo Demo Download Download

JSValidate

JSValidate is a form validator that uses prototype and scriptaculous to bring you a very easy Javascript form validator.

www.donotyet.com_jsvalidate form validation.png

Demo Demo Download Download

Field validation with Prototype

A robust Javascript form validation library built with prototype and scriptaculous. It has a number of tests built-in but is extensible to include your custom validation checks.

www.donotyet.com_Prototype form validation

Demo Demo Download Download

Validation Widgets

This Validator works fairly well. It is very easy to implement with Dreamweaver CS3. If you are not using Dreamweaver than you can download their Javascript elements.

www.donotyet.com_Adobe form validation.png

Demo Demo Download Download

Clean Form Validation

Clean Form Validation is a very simple Javascript form validation and it is very easy to implement.

www.donotyet.com_marcgrabanski form validation.png

Demo Demo Download Download

Ajax Form Validation – sForm

In the sForm case, to let users know what’s happening, incorrect fields are going to be red after validation and correct fields will turn green. An image will be added after each validation to express by visualization the fields correctness.

www.donotyet.com_chains form validation

Demo Demo Download Download

Gregphoto Ajax Form Validation

There are several benefits to this approach. Allows you to perform complex validation, such as verifying the uniqueness of a username, or checking something in the database…all without reloading the page. Allows you to use the same validation routine for both client-side validation and server-side validation. Reduces the amount of client-side code needed for validation.

www.donotyet.com_downloadjavascripts form validation

Demo Demo Download Download

ASP AJAX Form Processing And Validation

Using AJAX to validate forms has many advantages. The form is protected at server level – yet the client has ‘immediate’ feedback. Form fields are not wiped on post back – reducing user frustration.

www.donotyet.com_aspajax form validation

Demo Demo Download Download

Masked Input Plugin

This is a masked input plugin for the jQuery javascript library. It allows a user to more easily enter fixed width input where you would like them to enter the data in a certain format (dates,phone numbers, etc). A mask is defined by a format made up of mask literals and mask definitions. Any character not in the definitions list below is considered a mask literal. Mask literals will be automatically entered for the user as they type and will not be able to be removed by the user. The following mask definitions are predefined:

  • a – Represents an alpha character (A-Z,a-z)
  • 9 – Represents a numeric character (0-9)
  • * – Represents an alphanumeric character (A-Z,a-z,0-9)

www.donotyet.com_digitalbush form validation

Demo Demo Download Download

ASP.NET Validation using Ajax

This one will show how to perform server side validations even when complex scenarios arise, while avoiding post backs. It  can be used as a centralized validation component, which can perform all validations for an ASP.NET web site.

www.donotyet.com_codeproject form validation

Demo Demo Download Download

For help, advice, tips and tricks, challenges, feel free to visit ourDoNotYet forum or Submit your good resource to share.

Reminder: Unless stated otherwise, all resources published on this site are NOT for commercial use. To use any resource from this site for commercial purposes, please contact the author.

Related Posts