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!

Issue with history.back() in Firefox

Status
Not open for further replies.

needtechhelp

Programmer
Apr 30, 2008
1
0
0
US
I have an asp page that accepts payment information from user. I use the same page to confirm the payment information by hiding the div that has the input boxes & copying the credit card information in a bunch of spans in another div & showing this 2nd div with a submit button.

Here is how the code looks like:

paymentdetails.asp
-------------------
<div id="div1" style="display:block">
----
----
display input boxes for entering credit card information
----
display next button
</div>
<div id="div2" style="display:none">
----
----
onclick of next button in div1, values are copied in spans here & div1 is hidden and div2 (this div) is made visible
display spans with credit card information
-----
display previous button (just hides this div and displays div1)
display submit button (will submit the credit card information to paymentprocess.asp)
</div>

paymentprocess.asp
--------------------
If credit card charge was successful, then everything works fine. But if the credit card was declined, I display an error on this page & provide a "Back" button for user to go back & rectify the input they provided.

The "Back" button just has the onlick="javascript:self.history.back();" , so that it takes the user to previous page without loosing the information that they entered before (since the js code above will just display the page from cache).

It all works fine in IE. The user is taken to the paymentdetails.asp & div1 is displayed (so that user can make the changes) & div2 is hidden. But in Firefox, div1 is hidden and div2 is displayed (because the user submitted the form when div2 was displayed). This is not what I would like to have. I would want that div1 is displayed & div2 is hidden when the page is displayed from cache.

I tried using history.go(-1) instead of history.back(), but that did not help.

One interesting thing I noticed in Firefox is that when the credit card was diclined & instead of using my "Back" button, if I use browser's back button, Firefox displayed the paymentdetails.asp correctly with div1 displayed & div2 hidden.

Is it a firefox bug in their implementation of history object? Is their any other way I can fix this?

Any help is greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top