<class home>  <Jscript>   <back   next>

Validating Form Data

When a user fills in a form it can be useful to know if they filled in certain required fields. This is called "validation".

example

Name:

Email Address:

Age:

Do you want to be contacted:
yes
no

Check if you like red.


To Validate

1. Make your form with all the fields named

2. In the Behaviors panel, select a browser (3.0 and later).

3. In the Document window, select the form (you select from <form> to </form> in the html).

4. In the Behaviors panel, add the action Validate form.

5. In the dialog box, all your fields should be listed. Click the ones that you want validated and select from the options:

6. Click o.k.

9. In the Behaviors panel, select the onSubmit event

*note: a dialog box will appear if they fail to meet the requirements of the form.
*note2: you can also use the onBlur event to make the form lose focus (the content disappear if it is not the right content).