Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reset form when submitting to itself

Status
Not open for further replies.

hecktic

Programmer
May 14, 2002
84
0
0
CA
Hi,

I'm working on a form (using asp) with which does the following:

- Take the content from a textbox.
- Run a query using that content.
- The db results are submitted to the form itself.
- The form generates a table dynamically to show the results returned by the query.

My problem is that i want the form to be reset when the user refreshes the page, i.e. reload the page/form as if the user has never submitted it before.

Right now, when i refresh.. the results from the last submit keeps showing up. Resetting the query variable in asp code does nothing.

Anyone have any ideas about this?
Thanks in advance!
 
Are you putting a request("value") in the text boxes etc?

You could always just put a reset button on the page
<input type=&quot;reset&quot; value=&quot;Reset&quot;> Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
I get my data using:
method = request.form(&quot;IDmethod&quot;)

Run my query and generate my table. Everything is working like it should.

When i refresh, i want the page go back to the original version. Only showing my textbox and submit button,
NOT the dynamic table.

Reset button will only reset the form.. i want to reset the whole page.
 
A simple solution is to call the page itself again...

<input type=button value=&quot;Reset&quot; onClick=&quot;javascript: document.location='myPage.asp'&quot;>
 
True, this would work.

Lemme see if i can use this without a reset button.

Thanks
 
JavaScript has a function reset() that does the same thing as the reset button. Add the following below your form and you should be ok. I'm not sure of my syntax so you'll have to double check me. (Reset will reset to the default values of each element in the form.)

<script language=&quot;JavaScript&quot;>
document.formName.reset();
</script>
 
How about the javascript document.refresh? or something.refresh anyway, think it only works in IE though.

-tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top