Resetting forms using an Image Button
Note: This button will reset only text boxes,text areas and check boxes as list boxes and option buttons don't usually require resetting. After resetting the form the cursor will set the focus to the first field in the form.
Example of resetting a form using an image button (image field)
Cut and Paste Code
Cut 'n' paste code for the above Example
to see if it is a text field, text area or check box
by checking the type property for a 'text field or checkbox'
and checking the col property (no. of columns) for a
'text area' field. If found we set the field's value to null
(for text boxes or text areas) or unchecked (for check boxes).
- After resetting all values found it sets the focus to the first text, text area or checkbox field in the form. This is done by getting the index of the first form element encountered which was a text field, text area or check box and storing it in a variable called first. This variable is then used to set the focus.