If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

how to page with original hidden input settings

Hi,

I have a page that the hidden input fields and their values are written by a server side script (aspx). These input fields and their values are passed to some javascript during the body onload event to set visual elements. The user can change some of the visual elements by clicking on them to turn them "on". Everything seems to work like I want it to, with one exception. And that is if the page is reloaded. If a user selects an element by clicking on it, causing it to change to "on", and if the page is reloaded, that same element stays on, when it was originally off.

(1) Change the values of the hidden fields and SUBMIT the page back to the ASP.NET code. Have the ASP.NET code save those field values (in a database?) and so, when the user reloads the page, he gets back his changed values.

(2) Use cookies. Store the changed values in cookies, via JavaScript. When the page is reloaded from the server, see if there are any changed values saved in cookies. If so, let the cookie values overwrite the values from ASP.NET *before* the JavaScript use the values to set the visual elements.

There is also a (2-A): ASP.NET can read the cookies that JavaScript set, so you could have the ASP.NET code read the cookies and change what it puts into the hidden fields.

What I'm talking about is not a postback to the server. When the page first loads, it is set to display visual elements in a certain way. Users select images, which causes the image position to change through an onclick event client side. during this user selection process, there is not a postback to the server. Now, there will be a postback button that a user can click once the selection process is completed to the satisfaction of the user.

But what I'm trying to figure out is if during the selection process, before the actual postback, the user decides to reload the page, how can I prevent the newly loaded page from reading the previously loaded page's post array, and get the hidden input settings as they came from the server?

Looking at your avatar, I take it that your a rail fan. One project that I would like to do someday is to make an interactive map of the old lines. Something really nice, and kind of point out each line's notable trains or locos. May be some day.

Would be fun. Would you "age" it? That is, allow the user to pick a year and show the lines that existed in that year? I was looking at a map of lines as of the start of the Civil War. What a mess of spaghetti.

Users who have thanked Old Pedant for this post:

without seeing any code, it sounds like you have some visual form elements that control the page's look, and that those visual controls are set from hidden controls. most browsers persist any form value changes the user makes before a reload. this prevents lost form info. if the visual controls are not synced to the hidden inputs, chaos ensues.

if you can post a bit of the code that's cause trouble we can help you much better.

Users who have thanked rnd me for this post:

Would be fun. Would you "age" it? That is, allow the user to pick a year and show the lines that existed in that year? I was looking at a map of lines as of the start of the Civil War. What a mess of spaghetti.

Wow, that would be a challenge, collecting all that data and trying to display that. I don't know if I would do it be year. Maybe by period, like pre Civil War, Civil War to Golden Spike, Golden Spike to the beginning of WWI, WWI to the the Crash. WWII, Post WWII, the the fall.

I moved around a lot when I was a kid in the 60's. One place we live was Cheyenne, Wyo., which had a Big Boy on display at a city park, and a yearly celebration called "Hell on Wheels.". And I was living there during the 100th Golden Spike anniversary. which was fun. And my then living grandfather had worked for Rock Island. I would visit during the summer and from the house, the Rock Island track ran behind the house about ten minute walk. Further back was the Missouri Pacific. But, across the street was a short line that ran from Pine Bluff to a nearby wood mill. And they still used a steam locomotive the first time I came to stay for the summer. I think Cotton Belt bought the line in the mid 60's and ran a diesel switcher, like those curved roof Alco's. But, hearing that steam loco rumble through the woods was awesome. I with my mother made three passenger train trips to Arkansas when I kid. Two were on UP/MP from Cheyenne, and one from Grand Forks to Chicago to Memphis to Little Rock. Chicago to Little Rock was the Texas Eagle. I'm not sure was the ride from Grand Forks to Chicago was. Could have very well been GN or NP. All that being said, I have a fondness for the passenger trains.

Wish I had the money to have collected HO models. Anyway, What's your rail story? If you got any ideas about websites and railroads, would love to hear them.

I'm trying to get a domain name issue straighten out. Once I get that done, hopefully tomorrow, I can upload the code there. But, you are correct in that the initial settings for the hidden input values are set server side, and through user input, they change before postback.

Originally Posted by rnd me

without seeing any code, it sounds like you have some visual form elements that control the page's look, and that those visual controls are set from hidden controls. most browsers persist any form value changes the user makes before a reload. this prevents lost form info. if the visual controls are not synced to the hidden inputs, chaos ensues.

if you can post a bit of the code that's cause trouble we can help you much better.