Learn HTML Code Tutorial Reference Guide

TYPE = RESET

RESET resets the form so that it is the way it was before anything was typed in:

<FORM ACTION="../cgi-bin/mycgi.pl">
<INPUT TYPE=TEXT>
<INPUT TYPE=SUBMIT> 
<INPUT TYPE=RESET>
</FORM>

which gives us:

For a while it was the perception that all forms "had" to have a reset button, but designers have found that resets are more likely to detract from the form than add to it. Users don't usually need to reset their forms, and they are more likely to accidentally hit the reset button than they are to actually want to wipe out their work. Unless you have a specific reason to expect that users will need a reset button it's probably best to leave it out.

If you do choose to use have a reset button in your form, consider adding a check if the user actually wants to reset. You can do this by adding an onReset event handler to the <FORM ...> tag:

<FORM 
   ACTION="../cgi-bin/mycgi.pl" 
   onReset="return confirm('Do you really want to reset the form?')"
   >
<INPUT TYPE=TEXT NAME="query">
<INPUT TYPE=SUBMIT> 
<INPUT TYPE=RESET>
</FORM>

which creates this form:

If you add the VALUE attribute to the tag then that value is used as the text for the button.

<FORM 
   ACTION="../cgi-bin/mycgi.pl" 
   onReset="return confirm('Do you really want to reset the form?')"
   >
<INPUT TYPE=TEXT NAME="query">
<INPUT TYPE=SUBMIT> 
<INPUT TYPE=RESET VALUE="Start All Over">
</FORM>

which gives us:




 

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   Privacy Policy   |   About
Copyright ©1997-2002 Idocs and ©2002-2014 HTML Code Tutorial