Macromedia dreamweaver 8-using dreamweaver User Manual

Page of 1030
526
Chapter 18:  Using JavaScript Behaviors
10.
Click OK.
11.
Check that the default event is the one you want.
If it isn’t, select another event from the pop-up menu. If the events you want are not 
listed, change the target browser in the Show Events For pop-up menu.
Swap Image Restore
The Swap Image Restore action restores the last set of swapped images to their previous source 
files. This action is automatically added whenever you attach the Swap Image action to an 
object; if you leave the Restore option selected while attaching Swap Image, you should never 
need to select the Swap Image Restore action manually.
Validate Form
The Validate Form action checks the contents of specified text fields to ensure that the user 
has entered the correct type of data. Attach this action to individual text fields with the 
onBlur
 event to validate the fields as the user is filling out the form, or attach it to the form 
with the 
onSubmit
 event to evaluate several text fields at once when the user clicks the Submit 
button. Attaching this action to a form prevents the form from being submitted to the server 
if any of the specified text fields contains invalid data.
To use the Validate Form action:
1.
Select Insert > Form or click the Form button in the Insert bar to insert a form.
2.
Select Insert > Form Objects > Text Field or click the Text Field button in the Insert bar 
to insert a text field.
Repeat this step to insert additional text fields.
3.
Do one of the following:
To validate individual fields as the user fills out the form, select a text field and select 
Window > Behaviors.
To validate multiple fields when the user submits the form, click the 
<form>
 tag in the 
tag selector in the bottom left corner of the Document window and select Window > 
Behaviors.
4.
Select Validate Form from the Actions pop-up menu.
5.
Do one of the following:
If you are validating individual fields, select the same field that you have selected in the 
Document window from the Named Fields list.
If you are validating multiple fields, select a text field from the Named Fields list.