Google Answers Logo
View Question
 
Q: Textbox losses data, when you come back to the page by clicking BACK button. ( No Answer,   3 Comments )
Question  
Subject: Textbox losses data, when you come back to the page by clicking BACK button.
Category: Computers > Programming
Asked by: ceconi-ga
List Price: $10.00
Posted: 10 Sep 2003 11:07 PDT
Expires: 10 Oct 2003 11:07 PDT
Question ID: 254265
Problem Overview:
Textbox losses data, when you come back to the page by clicking BACK
button on browser.

Details:
I have WebForm1.aspx which has a textbox and a button. On 
click of that button, I redirect to WebForm2.aspx.

WebForm2.aspx only has a link on it.
<a href="http://www.msn.com" target="_blank">click here</a> 
As you can see, clicking that link opens up a new window.

Problem: 

Entering some text in textbox then clicking button, which 
takes to WebForm2.aspx.

Click on the link which opens up a new window. Close that new window
and click BACK button on
of browser, which brings back to WebForm1.aspx. But the textbox is
blank now. Textbox has lost the value


Question:

Why does the textbox loses the data? 

(If I don't click on the link on WebForm2.aspx and hit BACK button
then the data is there in textbox)

Thank you

Clarification of Question by ceconi-ga on 11 Sep 2003 08:34 PDT
You can look at it at

http://www.benefitsessentials.com/A.aspx

Clarification of Question by ceconi-ga on 12 Sep 2003 07:34 PDT
We are currently using windows 2000 / XP and IE ver 6.0
Answer  
There is no answer at this time.

Comments  
Subject: Re: Textbox losses data, when you come back to the page by clicking BACK button.
From: andyt-ga on 11 Sep 2003 21:48 PDT
 
I was not able to duplicate this bug on any of the Macintosh browsers
I tried, Safari or IE.  I'll take a look on a PC tommorow, perhaps. 
What browser/OS are you trying this with?
Subject: Re: Textbox losses data, when you come back to the page by clicking BACK button.
From: bikerman-ga on 12 Sep 2003 04:09 PDT
 
Hello,ceconi-ga;

I tried it in Konqueror 3.0.3, Mozilla 1.0.1, and Galeon 1.2.6, all
running on Redhat Linux 8.0.  In every case the text was still there
when I hit the back button.  I think it is a browswer-specific thing,
not anything you can control with your script because when they hit
the back button, the browser rarely retrieves a new version of the
page (it uses a cached version).

Here is a possible solution:

There are several headers you can send with your webpage that try to
prevent caching (you can also use META tags).  Set an "Expires:"
header to a date in the past, a "Last-Modified:" header to the current
date and time so that it is always modified,
"Cache-Control: no-store, no-cache, must-revalidate"
"Cache-Control: post-check=0, pre-check=0"
"Pragma: no-cache"

And use these META tags:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0">

Now use cookies or sessions to store the value of the text entered,
and have your script (WebForm1) check for the value and put it in the
textbox if it is set.

I could give you a code example in PHP, but I don't known ASP.  This
method wouldn't be foolproof because it relies on the user agent to
honor the headers/meta tags and not cache the page.  The headers I've
given may not be exhaustive, and may not even all be necessary, but
I've seen them used.  I've also seen people having problems with pages
still getting cached while sending those headers.

Just a thought.  Hope it helps you a little.
bikerman-gar
Subject: Re: Textbox losses data, when you come back to the page by clicking BACK button.
From: andyt-ga on 12 Sep 2003 17:11 PDT
 
Indeed, I tried it on a win2k box with IE, and if you switch browser
windows the post data is lost.  After some initial searching, I
couldn't find a simple solution.

My suggestion, is to store the value of the textbox in a session, and
set the value of the textbox equal to that session variable.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy