Validating HTML form data
Dreamweaver can add JavaScript code that checks the contents of specified text fields to ensure
that the user has entered the correct type of data.
Note: This feature only works with HTML forms. For ASP.NET forms, you can insert ASP.NET
validation controls in Code view. For more information, consult the ASP.NET documentation.
To validate form data:
Create a HTML form that includes at least one text field and one Submit button.
1
Make sure every text field you want to validate has a unique name.
Select the Submit button.
2
In the Behaviors panel (Window > Behaviors), click the Plus (+) button and select the Validate
3
Form behavior from the list.
The Validate Form dialog box appears.
Note: The Validate Form behavior is available only if a text field has been inserted into
the document.
Set the validation rules for each text field and click OK.
4
For example, you might specify that a text field for a person's age accepts only numbers. For
more information, see
Related topics
•
Chapter 18, "Using JavaScript Behaviors," on page 371
Attaching JavaScript behaviors to HTML form objects
You can attach JavaScript behaviors stored in Dreamweaver to HTML form objects such as
buttons.
Note: This feature does not work with ASP.NET form controls because these controls are processed
on the server.
To attach a JavaScript behavior to an HTML form object:
Select the HTML form object.
1
In the Behaviors panel (Window > Behaviors), click the Plus (+) button and select a behavior
2
from the list.
For more information, see
620
Chapter 39: Creating Forms
"Validate Form" on page
Chapter 18, "Using JavaScript Behaviors," on page
397.
371.
Need help?
Do you have a question about the DREAMWEAVER MX 2004-USING DREAMWEAVER and is the answer not in the manual?
Questions and answers