Reset button on form...?

liunx

Guest
Why, oh why, oh why.................!!!<br />
<br />
A simple form. A simple reset button, and a reset button made of an image. The problem, if you run it, is that the image 'reset' button resets the form...then reloads the page, while the HTML 'reset' button just resets the form. Whats going on here??!<br />
<br />
<html><br />
<head><br />
<title>Untitled</title><br />
</head><br />
<body><br />
<form name="s" action ="go.htm" action="post"><br />
<input type="text" size=15><br />
<input type ="image" src=http://www.htmlforums.com/archive/index.php/"http://www16.brinkster.com/harbor31/reset_clear.gif" name="reset" width=75 height=35 alt="reset" onclick="document.s.reset();"><br />
<input type="reset"><br />
</form><br />
</body><br />
</html><br />
<br />
<br />
looking around for an extra hammer............<!--content-->The last time I checked, there is no form type for a graphical reset button. When you use type=image, it is a submit button. <br />
<br />
Regards,<br />
Kevin<!--content-->that would be why......<br />
Hmmn, and I have been trying to set focus, return=true, and anything that came to mind just to avoid that. Looks like I'll have to try for a workaround.<br />
<br />
Thanks Kevin!<!--content-->The standard work around is to use a graphical reset button that is really just a hyperlink back to the page with the form on it. That way you can have a matching set of graphical buttons, but one is really just a hyperlink as stated above.<br />
<br />
Regards,<br />
Kevin<!--content-->except that that reloads the page. By not putting a submit action, or method in the form tag...I can halt the submission of the form on reset.....but I still get the reloading of the page-which I am trying to avoid.<br />
<br />
I will just do some quick client side JS to empty out the fields. <br />
<br />
Thanks!<!--content-->For the click event try:<br />
<br />
onclick="document.s.reset();rerurn false;"<!--content-->that seemed to work like a charm!<br />
Thanks COBOLdinosaur, and welcome to HTML forums!<!--content-->hmmmnn....no wait.....after I tested on live server I realize it is still reloading. <br />
<br />
I am going with Kevin's advice, using a href'ed image, and calling a function to manually clear out the form elements. If I just put an href and call reset() onClick it still reloads the form, and I am trying to minimize calls to the server. I'll continue this post in client side scripting. <br />
Thanks all!<!--content-->Ian made a simple solution of this over in client side...<br />
<br />
<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?threadid=3458">http://www.htmlforums.com/showthread.php?threadid=3458</a><!-- m --><!--content-->This code clears any form without reseting the page. Works just like the default Reset button. Enjoy!<br />
<br />
<INPUT onclick="document.forms[0].reset();return false" type=image height=18 alt=Clear width=46 src=http://www.htmlforums.com/archive/index.php/"images/clear.gif" border=0><!--content-->for one, this thread is 4 years old. for two, the perfect solution is this<br />
<br />
<input onclick="this.reset();" type=image height=18 alt=Clear width=46 src=http://www.htmlforums.com/archive/index.php/"images/clear.gif" border=0><br />
<br />
the stuff in bold does nothing as you specified it as a input. those mean nothing.<!--content-->Thanks for clarifying scoutt<!--content-->
 
Back
Top