Attribute for <FORM ...>
onReset = "script command(s)"

onReset runs a script when the user resets the form. If onReset returns false, the reset is cancelled. Often when people hit reset they don't really mean to reset all their typing, they just hit it accidentally. onReset gives them a chance to cancel the action.

This code checks with if the user really wants to reset the form:

<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>

This gives us this form:





About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.