View Full Version : Form data disappears after page refresh
06-13-2007, 08:38 PM
I am using the following code to refresh a window that has an HTML form on it:
When the page is refreshed, the data disappears.
Is there a way to refresh the page, while keeping the form data?
06-14-2007, 12:25 AM
Do you mean keep the data the user just entered? If so, you need to save the user entries in the session or database when the popup is loaded. You need to explain a bit more to get complete reply.
06-14-2007, 07:50 PM
Yes, that is what I mean. The form data may not have been submitted at the time of the refresh.
I have a window (#1) with a form. #1 has a link to pop up another window (#2) with another form. When the form on #2 is completed, #1 is refreshed.
My project is a combination of ASP and JS. I understand session variables in ASP, which are kept on the server side. I'm guessing that JS saves the values on the client side?
There was a time, when you could enter data into a form and press the F5 button to refresh, and the form data would still be there. This does not appear to be the case in the newest versions of Firefox and IE.
06-14-2007, 08:29 PM
Set the values of the fields in form #1 to corresponding session variables. When session variables are not yet set (first load of the form), the field would be empty (this is fine).
<input type="text" name="txt1" value="<%=session("txt1")%>" />
When link is clicked, submit form #1 to a popup window.
var w=window.open("", popupName, "width=500, height=400, resizable=1");
<form name="frm" method="post" action="form2.asp" target="popup" onsubmit="return createPopup(this.target);">
<input type="submit" name="btnSubmit" value="Submit" />
In form #2 page, save the user inputs to session variables.
session("txt1") = request.form("txt1")
When form #1 is reloaded, session variables are already set, so the fields would have the values the user entered.
06-15-2007, 08:41 AM
you might like:
for 4/5 of you users anyway...
you can store/load them in a cookie as well, or serialize up to 2kb in your querystring being passed to the popup.
06-20-2007, 07:26 PM
Thank you for your solutions. I believe, however, that both of the solutions provided assume the form is being submitted before the popup. This isn't the case. They may have half-completed the form, then needed to view the popup, before submitting.
At this point the issue is moot with this project, as we ended up going a different route anyway.
Thank you for your assistance.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.