Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Dreamweaver

This chapter is from the book

REQUIRING INPUT

Making sure that a user has completed a form correctly is made easy with the Check Form behavior. The Check Form behavior will let you specify which fields are required and you can choose the type of user input, such as email address, a number, or within a range of numbers. After you've established a form with one or more text fields or text areas, use the Tag Selector to select the form tag. Now click the Add (+) button on the Behaviors panel and choose Validate Form near the bottom of the drop-down list. When the dialog appears, select the form field in the list and choose the appropriate values for the remaining options. You may do this for each of the fields listed in the dialog.

By applying the behavior to the <form> tag, the validation occurs at the time the user submits the form. If the requirements are met the form is submitted, otherwise the user will get a JavaScript alert letting them know what fields need to be corrected. If you want the validation to take place while the user is filling out the form and proceeds to the next field apply the behavior to each text field element rather than to the <form> tag.

Figure7.26Figure 7.26

  • + Share This
  • 🔖 Save To Your Account