Dreamweaver behaviors do some checks on how users complete forms. You can make certain fields required, check to make sure that a user has entered a value in a required field, or check to make sure that the user entered the correct type of information in a field.
With the Validate Form behavior you can set parameters for an entire form. You can also use the Validate Form behavior on individual fields. See Chapter 10, "Using Forms and Fields," for more information about making a form with Dreamweaver.
| 1. | In the document window, select the Submit button. or Select the <form> tag from the tag selector. |
| 2. | On the Behaviors panel, click plus and select Validate Form. The Validate Form dialog will open ( Figure 12.23 ) and display the fields: - Named fields: Select the first field in the box.
- Required: Select this if the user must enter data in this field in order for the form to be accepted.
- Anything: Check this radio button if any combination of text and numbers is acceptable.
- Number: Check this if you want the user to enter a zip code, phone number, or other strictly numerical data.
- Email address: Choose this if you want to check for an @ symbol within the entered data.
- Number from: Select this if you need to check for a number within a specified range.
Figure 12.23. One form validation option is to require an email address from the user. |
| 3. | Select the remaining fields in the Named fields box and set the parameters for each until you have completed the dialog for each field in the form. |
| 4. | Click OK to accept your changes. |