Project 3- JavaScript Validation

Contents included in this project:

Project Description and Write-up

For the project, a form supplying information to some CGI handler is validated prior to even trying to process the form on the distant server. The validation is performed client-side by using JavaScript. Performing validation functionality on the client as opposed to on the server cuts down on potential server load, and ensures (to a degree) the correctiveness of the information.

For the purposes of this project, the form being validated does not have to process anything through a CGI handler or connect to any remote server because the purpose is to display the client-side effectiveness of JavaScript validation - all activity will occur on the client's web browser.

[Back To Top]


Example One - Validation Form (as assigned for the project)

Here is a standard HTML form posting to a FormMail script, however, it is using JavaScript for validation.

Validation of forms using JavaScript saves on connection overhead and potential greater latency involved in having servers validate form information. JavaScript allows for the validation to occur at the client site.

This form invokes JavaScript validation on two different occasions:

  1. The first is after focus has moved from a parrticular textfield to another by either a click of the mouse, or by tab.
  2. The Second occurs after the "Submit" button has been triggered.

Give the form a whirl! If you get to a CGI FormMail error message (a real FormMail script without a specified recipient,) then you know that you've worked the form all the way!

The JavaScript Validated Form:

Interestingly enough, I've included an alternative way to validate some things - Using a Drop-Down List Box (DDLB) for selecting the state, I've validated the field by limiting the choices for the user. Anything the user selects is a valid entery by design.

 

[Back To Top]


Example Two - Form used to process tuxedo sizes for my wedding!

Here is an example of a form used to submit tuxedo sizes for members participating in my wedding. The form actually works, emailing me the information entered into it. In order to make sure that all of the fields were filled, JavaScript is used to validate the user's input. The site is: www.imwiz.com/weddingsite/mainsite/services/tux.htm

Some of the nifty items of this validation routine is that it has a rather stringent email validation, and upon hitting the "Submit" button, it gives focus to the text-box needing user correction.

[Back To Top]