[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to refresh a page and not clear form contents

Posted on 2006-04-05
7
Medium Priority
?
285 Views
Last Modified: 2008-01-09
Hi. I am using ASP VBScript (not .NET).

I have created a form on a page.  When data is entered, I would like for it to remain after refreshing the page.  I will clear it with the "Clear" button, but I don't want it to clear until then.

I'm not sure if this has something to do with "Session Variables", or not.

Could someone, please, assist me with this?

Thanks so much.
0
Comment
Question by:lshane
  • 3
  • 3
7 Comments
 
LVL 17

Expert Comment

by:HuyBD
ID: 16390155
Hi lshane!
add script to your file

<script>
window.onload = function () // when the window is reloaded, check if a scroll value has been saved
   {
return;
   }
</script>
0
 
LVL 3

Expert Comment

by:Cirieno
ID: 16392418
Depending on what you mean by "refresh" (I'm assuming you don't mean "submit", because then all you'd have to do is prent out the received values) there is one solution that I can see, with two methods: use javascript to save the values as they are typed.

The time increment is up to you but I'd suggest saving values after 5 seconds of keyboard inactivity.  Now as to where you save the values, you could save them either to a cookie (if they are small values, remembering a cookie has limited size and not everyone has them turned on) or to a server (using a sessionid as the person's identity).

This idea is taken from one of the fundamentals of the Javascript tecjnology named Ajax, so either look around EE for more help on that or browse the hundres of tutorials on the web.  Basically you're saving what people type as they type, so when the page is refreshed you can pull back the information as it was stored only 5 (or whatever) seconds ago.

Of course, if the user doesn't have Javascript turned on this technique won't work and I can't think of a non-scripted solution...
0
 

Author Comment

by:lshane
ID: 16393117
Good points.  I am actually referring to when someone presses the "refresh" button on the browser.  That always clears the form.  Perhaps it should.  I was mainly wanting to know if there was a way to keep it from clearing when the "refresh" button is pressed, and to only clear when a user presses the "Clear" button on the form.

Is that possible, or even useful?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
Cirieno earned 2000 total points
ID: 16393210
As above, I can't think of any other way to keep the state in an inherently stateless system.  You can't stop the refresh working, it is meant to clear form values as you suggest... all you can do is hopefully store the data away somewhere (cookie or database) every so often (like an autosave function, essentially) and pull it back from that store when the page is refreshed (serverside or ajax-ified, that's your call as the developer -- I'd stick with serverside myself, it's far more simple).
0
 

Author Comment

by:lshane
ID: 16393461
Great. I suppose that is what I was needing to know... that the "Refresh" button is meant to operate that way.  It seems that what I was trying to do may not even be useful unless the user has a LOGIN.

Thanks so much.
0
 
LVL 3

Expert Comment

by:Cirieno
ID: 16393651
No problems, thank you :)

As an aside: to use the options I've listed above, the user wouldn't have to be logged in as they would be given a session ID when they open their first page -- if you keep that session ID with them all long the way (either as a querystring value, and/or hidden inside forms) then it doesn't matter if they are logged in or not, you can still track them and so still save the data as attached to that sessionID.  Just a thought.

0
 

Author Comment

by:lshane
ID: 16396257
Great.  Thanks for the addendum.  I still have some things to learn with ASP, clearly.  Just trying to grasp the theory at the same time.

Thanks so much.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question