SYST28043 - 3 UNITS
WEB TECHNOLOGIES


FORM VALIDATION JAVASCRIPT SAMPLE

It is a little more efficient to validate form fields on the client otherwise all the data gets sent to the server and the server has to validate and send back an alert message if there is one. So here is how you can check to see if the name field is filled in and the postal code and e-mail are in proper format. There is a simple check and complex check for the e-mail:

Name:
Postal Code:
E-mail:



Testing strings is most efficiently done with Regular Expressions:
DevEdge JavaScript Regular Expressions

In the text box below is the code less the script tags:


Sheridan - School of Applied Computing and Engineering Sciences - Web Technologies