Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remembering tabs, after user hits back button 1

Status
Not open for further replies.

peterswan

Programmer
Sep 25, 2002
263
US
Hello,
I wrote a DHTML application with tabs that the user can choose. Each tab displays a different form with different dropdowns to choose from. After the user chooses one of the tabs and fills out the form and hits submit, the results page displays.

At this point, when the user hits the back button, the original page with the tabs displays, however, the default tab always displays. The page cannot remember if the user chose a different tab and then hit submit, and then went back. What I'd like the page to do in this case is load the page with the user-chosen tab displayed.

The code I'm using is simple DHTML. The tabs are enclosed in <div> tags which, when clicked, calls a JavaScript function that changes the color and display attributes of the <div>.

Any ideas?

Thanks, [smile]

Peter
 
you will most likely need to store a cookie on the user's machine that contains a flag indicating which tab was activated. you can then reference the cookie and display the appropriate tab.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
works great cLFlaVA.

Thanks for your help.

[smile]

Peter
 
I know you already have a solution in place but if you had server-side code capabilities I would do this a session variable.

Some people disable Javascript which of course would mess up your tabbed navigation quite a bit but more people disable cookies than javascript which would cause you the same problem you are trying to prevent.

Cookies are one method, session variables are another and passing a value on the URL would be an effective third option. I use the URL on one site that I designed to be completely functional even if Javascript is disabled.
I used the URL rather than session variables in case the user was to bookmark the page, then my page script would always know how to setup the navigation even from a bookmark.



Google, you're my hero!
 
Hi NightOwl,

Yes, I'm running ColdFusion, so a session variable would work here. However, CF session vars use browser cookies just like JavaScript.

I don't think a URL variable alone would help me here. I could submit the form in JavaScript, thus effectively passing the tab value to the action page in the URL. But remember, after this the user is hitting the "Back" button, which would load the original form page and disregard any tab selection the user had chosen. I don't believe there is a way to pass a URL variable to the "Back" page.

Thanks for the idea with the session variables. Hoewever, I think I'll stick to the JavaScript idea as previously outlined.

Thanks, [smile]

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top