Sex date no registeration - Javascript for validating registration form

The message is shown to the user when reporting the problem.If the argument is the empty string, the custom error is cleared.Now to run this, copy the code into a folder inside htdocs or www folder of your PHP installation and log unto you browser and run it.

javascript for validating registration form-54

In other words, in order to validate a field, you just associate a set of validation descriptors for each input field in the form. For such cases, a function is included which clears all validations in the validator object. Note that this validation if for fields like Textbox and multi-line text box.

For ‘selections’ like drop down and radio group, use an appropriate validation like ‘dontselect’ or ‘selone_radio’.

Validation attributes allow you to specify rules for a form input, such as whether a value must be filled in; the minimum and maximum length of the data; whether the data needs to be a number, an email address, or something else; and a pattern that the data must match.

If the entered data follows all of the specified rules, it is considered valid; if not, it is considered invalid.

The Java Script class presented here makes the form validations many times easier.

The script has a catalog of almost all the common validation types built-in.

The idea is to create a set of “validation descriptors” associated with each element in a form.

The “validation descriptor” is nothing but a string specifying the type of validation to be performed.

Let's see how to use this API to build custom error messages.

Tags: , ,