Validating web form controls using dhtml

This means that the input data must contain at least an @ sign and a dot (.).

Also, the @ must not be the first character of the email address, and the last dot must at least be one character after the @ sign.

First create the form, then using Java Script we will validate the Email Id field, that is we will check if the user has entered a valid email id. we need to display to the user the error and make user they enter the proper format.

Here goes the code for the form, Basically the script does the following, The function above checks if the content has the general syntax of an email.

validating web form controls using dhtml-46validating web form controls using dhtml-22validating web form controls using dhtml-70validating web form controls using dhtml-13

Example 7-6 shows four examples of handlers for buttons that use methods or functions defined for the browser has any complexity.

The first parameter is the URL to request in the new window, the second is a title, and the third is a set of properties the new window has.

Without the list of properties that are included, the default new window has no Location box, no toolbars, no scrollbars, and can't be resized: it's an evil console!

If you have never created web forms with validation then I invite you to follow along with this tutorial for creating a simple form that will perform validation of several different text fields and one text area field on a web page.

I am utilizing Dreamweaver and its Validate Form Behavior in my example here; however, any web editing tool can be used to accomplish the same tasks with similar results using the code snippets provided.


Leave a Reply