Controlling Data Entry Using Form Fields
Creating 'Encoded' Name & Value Pairs
Passing data from one form to another
Addressing Form Field Validation with Regular Expressions and JavaScript 1.2
You are here: irt.org | Articles | JavaScript | Form | Chapter 6: Beginning JavaScript [ previous next ]
Published on: Sunday 29th April 2001 By: Paul Wilton
Two additional types of button are the submit and reset buttons. Defining the submit and reset buttons is done in the same way as defining a standard button, except that the TYPE attribute of the <INPUT> tag is set to submit or reset rather than button. For example, the submit and reset buttons in the earlier screenshot were created using:
<INPUT TYPE="submit" VALUE="Submit" NAME="submit1"> <INPUT TYPE="reset" VALUE="Reset" NAME="reset1">
These buttons have special purposes, which are not related to script.
When the submit button is clicked, the form data from the form that the button is inside gets automatically sent to the server, without the need for any script.
When the reset button is clicked, all the elements in a form are cleared and returned to their default values; the values they had when the page was first loaded.
The submit and reset buttons have corresponding objects called Submit and Reset, which have exactly the same properties, methods, and events as a standard Button object.
Controlling Data Entry Using Form Fields
Creating 'Encoded' Name & Value Pairs
Passing data from one form to another
Addressing Form Field Validation with Regular Expressions and JavaScript 1.2