SWE 432 JavaScript example: Form Validation 1

This JS is broken, October 2015

Text version Next example Back to index

This is an example of using JavaScript to validate forms data. The document.forms property contains an array of Form entries in the document. They can be accessed by name and by number:

// By number:
var firstForm = document.forms[0];

// By name, assumes < form name="orders" ...>
var orderForm = document.forms["orders"];

// By name, assumes < form name="register" ...>
var orderForm = document.forms["register"];

Programmers can do several things with this:

To see an introduction to any of our on-line training courses, please enter the name of an important Web programming language below.