by Dinesh Thakur Category: HTML

SUBMIT- After filling up the form, the user needs to submit the information. An <INPUT> tag with type = submit provides a button that submits the information in the completed form to the URL, given as the action attribute of the FORM tag.

The information is submitted using the HTTP request type specified by Form's method attribute .

Syntax

<INPUTtype="submit" Value="button label text">

 

Value: This attribute will change the text mentioned on the button just substitute your text in the value attribute. By default "submit" as written over the button. The button size will be controlled directly by the text length.

RESET: The reset value of the type attribute clears all form entries to the default one or leaves them blank if no defaults are specified Not al HTML forms will use this feature, but it can help users to start afresh or if they want to reconsider the default options.

Syntax
<INPUTtype="reset"Value=" button label text">

The "Value" attribute again is used to specify the text on the button. These buttons can be placed anywhere in the form. But the best place for them is below all the other input fields.

The following lines of code will add these buttons to our sample form.

<html>

<head><title> text fields</title></head>
<bodybgcolor="pink">
<palign="center"><b>admission form</b> <form> <p>
<inputtype="text"name="name"value="enter your name:"size="25"maxlength="30"> name<br><br> <inputtype="password"name="passwd"size="25"maxlength="30"><br><br> <inputtype="text"name="address"size="25"maxlength="30"> address<br><br> <inputtype="radio"name="sex"value="male"checked>male<br> <inputtype="radio"name="sex"value="female">female<br>
<selectname="country">
<optionvalue="india">india
<optionvalue="america"> america
<optionvalue="australia"> australia
<optionvalue="new zealand"> new zealand
<optionvalue="china"> china
</select><b>country</b>
<textareaname="comments"rows=2cols=20wrap="virtual:"> place your comments here: </textarea> <b> comments </b>
<palign=center>
<inputtype="submit"value="submit">
<inputtype="reset"value="reset">
</form>
</body>
</html>

An image can also be used for submit button. The image value of the "type" attribute provides a graphical submit button. It works exactly same as the submit button.

Syntax

 

<INPUTtype="image"src="image_url"height="n"width="m"alt="alternative text ""border = 0">

src: This attribute gives the URL of the image source file.

Width: To specify the width of image.

Height: To specify the height of image.

Alt: On rolling mouse over the image, the text mentioned is displayed. If someone is running without images they can still submit the form.

Border: To specify border for the image. In the syntax it turns off the border. The image value is by default for a submit button only. It cannot make a reset image button.

The following code adds an image submit button to our sample form.

<html>

<head><title> text fields</title></head>
<bodybgcolor="pink">
<palign="center"><b>admission form</b> <form> <p>
<inputtype="text"name="name"value="enter your name:"size="25"maxlength="30"> name<br><br> <inputtype="password"name="passwd"size="25"maxlength="30"><br><br> <inputtype="text"name="address"size="25"maxlength="30"> address<br><br> <inputtype="radio"name="sex"value="male"checked>male<br> <inputtype="radio"name="sex"value="female">female<br>
<selectname="country">
<optionvalue="india">india
<optionvalue="america"> america
<optionvalue="australia"> australia
<optionvalue="new zealand"> new zealand
<optionvalue="china"> china </select><b>country</b> <textareaname="comments"rows=2cols=20wrap="virtual:"> place your comments here: </textarea> <b> comments </b>
<palign=center>
<inputtype="image"src="c:\windows\hlpglobe.gif"alt="submit"width=55height=40> <inputtype="reset"value="reset">
</form>
</body>
</html>

 





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.