Forum Moderators: open

Message Too Old, No Replies

reset form on submit?

auto-reset a form upon clicking submit?

         

postcurser

10:00 am on Feb 23, 2006 (gmt 0)

10+ Year Member



Is it possible to have a form auto-reset when the submit button is clicked? Anyone know how?

Thanks :)

DrDoc

5:58 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

The problem is -- you don't want to reset the form until the data has been submitted, or else the submission will be screwed up. And, when the data has been submitted, the page is redirected anyway (which means there is no need for resetting of data anyway).

Otherwise, just call the

reset()
function on the form.

document.myForm.reset()
OR
document.getElementById('myform').reset()

postcurser

8:23 pm on Feb 23, 2006 (gmt 0)

10+ Year Member



I'm using this for my own portal page, and all my forms opens in a target _blank, that's why I'd like it to auto-reset them, unfortunately, I'm not sure how to deploy the code you supplied ...

Thanks though :)

DrDoc

11:32 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the new window, put something like this:
window.opener.document.forms[0].reset()

postcurser

11:25 am on Feb 24, 2006 (gmt 0)

10+ Year Member



this did it:
onmouseup="reset();

DrDoc

8:52 pm on Feb 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where is the onmouseup defined?