In order to access your form fields in code, you need to assign names to the form and each of the fields. For more information see, NAME Attribute | name Property.
You may assign any name you want that is composed of alphanumeric characters (without spaces), but to make writing the code easiest, you should provide a useful, friendly name for each of the fields.
You need a custom function that you can later connect to the form.
In this table, Element refers to the name of the HTML element for the form field, Type refers to the value of the type attribute for the form field, and Label refers to the text to the left of the form field. Form code updated with name attribute values Now that you have assigned names for the form and form fields, you are ready to start writing the script that handles the validation for the fields. If you are typing the Java Script code in this article manually and receive errors, you should check that all casing is the same as shown in this article.
Otherwise, you may want to review JScript Run-Time and Syntax errors.
A function is a piece of code that consists of one or more lines of script.
A function can take arguments and can return values.
Because the code is stored within the page or within a linked file, it is downloaded into the browser when a user accesses the page and, therefore, doesn't require a roundtrip to the server.
For this reason, client form validation can be faster than server-side validation.
Lisa Wollin Microsoft Corporation May 2004 Applies to: Microsoft® Office Front Page® 2003 Microsoft Front Page 2002 Microsoft Front Page 2000 Summary: Learn how validate HTML form fields using Java Script in Microsoft Office Front Page 2003.
This article assumes a general understanding of HTML and Java Script.
The action attribute tells the browser what to do when a user submits the form.