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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Page Expiring

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Guys,

I have a form page which, when submitted, loads order information into our Db and sends out confirmation emails. I would like to prevent the user from going back and submitting the form again.

Can I make the form page expire so that it cannot be displayed or can I change the entry in the history so that going back goes to a different page? Mise Le Meas,

Mighty :)
 
i assume you are using some server side stuff to handle your form submissions. could you set a session variable as true on submitting the form and have a condition of viewing the form page being the variable is false? ie if false show form stuff else if true show some other html saying the page has expired. dont know if this would work for the back button though as ive only just started messing around with that sort of stuff...
 
The only way to remove a page from history is to use the JavaScript method location.replace() in your navigation. I had a similar problem like yours and this was the workaround that I used.


<script language=&quot;JavaScript&quot;>

function goThere(form_obj) {
var value1 = form_obj.field1.value
var value2 = form_obj.field2.value
location.replace('page.asp?A='+value1+'&B='+value2)
}

</script>


<form>
<input type=&quot;text&quot; name=&quot;field1&quot;><br>
<input type=&quot;text&quot; name=&quot;field2&quot;><br>
<input type=&quot;button&quot; onClick=&quot;goThere(this.form);&quot;>
</form>


The key is that the location.replace() method replaces the current page in session history with the url defined in that method. Therefore, the Back button will not take the user to the form page.

Then on the page processing the form, I examine the QueryString to get the key/value pairs.

It obviously has it's limitations, but does work.

Hope this helps.

TW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top