/    Sign up×
Community /Pin to ProfileBookmark

List built with javascript is cleared by the back button

I have an HTML form that collects a lot of data. Seven of the fields are drop-down lists that are built dynamically with javascript. The problem occurs when a user hits the back button to return to the HTML form and edit data. The form retains the user entered data for all of the fields except the list built from javascript. The lists revert back to the original list if I use onLoad in the body tag or if I use onFocus at the form element itself. I am not permitted to use cookies on this site so I cannot store the data locally. My only success has been to write all of the data to ASP session variables, default the HTML form values to these session variables and then prevent the browser from caching the HTML form. The problem is that with all of the data I am passing, this has been a resource hog. Can anyone think of a way that I can build these lists dynamically yet preserve the user entered value if they hit the back button?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@MikeOSApr 04.2003 — You could try using frames. Write the values the user selects into variables in a script in the framesetting document. This document is always present so those values will always be available and won't change unless you change them with other code. You then set the appropriate list item when they return to the page using code. Remember that you don't have to actually have more than one page in a frame, you can simply set up one frame (as in one window), you just need to make sure you have that framesetting document. I used this method several months back for the same reasons you seem to need, it worked without any problems.
×

Success!

Help @ksnyder spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...