First apologize if this has been answered, but I am having trouble finding results for the issue I'm having.
Here's the deal. My company wasn't supporting issues that arosed when the user pressed the back button. Alot of our web development was for the restaurants in which they ran within a custom browser that didn't even have a back button.
But now I've developed a menu'ing system for the company last year. Up till now, we were telling the users that if they wanted to return the previous page that they must click on the provided "return" link on the web page.
Well now a new company of ours is asking to be able to use the back button to return to the previous page.
This isn't the problem, we have the that part working.
We are using CGI processing....
Let's say that we have a drop-down box (list) that when the page is loaded it appears like so.
HTML Code:
<SELECT NAME="LOCATION" onChange="document.forms[0].submit();">
<OPTION VALUE="C001" SELECTED>Company 001</OPTION>
<OPTION VALUE="C002">Company 002</OPTION>
<OPTION VALUE="C003">Company 003</OPTION>
</SELECT>
So when the page loads, it has company 001 selected, as expected. And all information on the page is for company 001.
If the user is to change the company and select company 002, the page is submitted back to the mainframe to process the next "web page".
The now the web page has company 002 selected and showing the information for company 002.
Now the user is wanting to be able to press the back button and return back to company 001.
Everything works fine except that the drop down box still has company 002 selected. NOTE: the information on the page belongs to company 001.
I realize that the back button will only return the history of the last state that the previous page was at before the submit action occurred. But I was wondering how others are getting around this issue. I have a couple of ideas but the seem to be sloppy.
1. Create hidden fields to save the value of the original value of the drop down box. These would be created with the CGI program. for example the user would see this in the source.
HTML Code:
<INPUT TYPE=HIDDEN NAME="SAVCOMP" VALUE="C001"
Then when the user presses returns back to this page, an onLoad event will take place and assign this saved value back to the dropdown box.
2. Use cookies, to save the initial values. Question: If you already have 20 cookies created for the session and you were to create a cookie for the page only, would that cookie overwrite one of the previous session cookies? I know that you can only have 20 cookies per domain. We're not using 20 cookies anywhere, but it's something to think about. When I first wrote the menu'ing system, I was using over 20 cookies, and one was randomly being overwritten. So I never actually got over 20. The system now just uses one cookie that is variable separated.
We were thinking today how we could resolve this issue and that we couldn't have been the first company to come across this issue.
So any help would be greatly appreciated.
Thank you
Mike