Jump to: navigation, search

An Overview of HTML Forms

78 bytes added, 18:27, 5 June 2007
The JavaScript Button Object
In the above example you will see some text before the closing </textarea> tag. If provided, this represents the text to be displayed by default in the TextArea object.
== The JavaScript HTML Button Object ==
Next to the Text object the JavaScript HTML Button object is probably the second most commonly used GUI componenent when developing JavaScript HTML forms. There are three types of Button object available. As with the Text object , the Button objects use uses the <input> tag. The ''type='' attribute ius is then used to define which type of button is to be created. The three different types are:
* '''type="BUTTON"''' - The basic button which performs no action by default unless an event handler is assigned to it.
* '''type="SUBMIT"''' - The submit button. When pressed this button causes the data in the Form to sent to the server using the settings defined in the enclosing <Form> tag. If the ''onsubmit'' attribuite on the enclosing ''<form>'' tag has been specified this will be executed before the form data is submitted (useful for JavaScript form data validation).
* '''type="RESET"''' - The reset button. When pressed causes the fields in the Form to be either cleared, or reset to the defaultValue (if one has been specified).
<form name="registerForm" method="GET" action="/cgi-bin/registersubscribe.cgiphp">
<input type="TEXT" name="myName" value=""/>
When the submit button is pressed in the above example the data in the two Text fields will be submited to the registersubscribe.cgi php script specified in the <form> tag.
The generic "BUTTON" type can be defined as follows:
<form name="registerForm" method="GET" action="/cgi-bin/register.cgiphp">
<input type="TEXT" name="myName" value=""/>
In this case we have configured the button to call a JavaScript function when it is pressed. This function could, for example, pop up a window containing a description or product code list. To learn about JavaScript we recommend [[]].
== JavaScript Check Boxes ==

Navigation menu