3

Would it be possible for me to have the URL of a given page change depending on what Vertical Tab the user clicks on the page?

For example, when a user is on a complex node form on my site, there are many tabs, each one providing a separate group of information about the node. I'd like for the user to be able to click on a link inside one of the fieldsets, and be able to click the back button to jump straight back into the fieldset he was viewing previously.

Right now, since the fragment isn't in the URL, the user is always brought back to the first vertical tab, regardless of which was open when a link was opened.

If I manually enter the fragment of the #id of the vertical tab that should be opened (like example.com/node/200/edit#my-vertical-tab-id), that works. Is there a simple way to make it so that when a user clicks on a vertical tab, it's anchor fragment is appended to the end of the URL?

1

You could use JavaScript to change the URL fragment each time a tab is opened (click listener on the tab changes the fragment to that tab's ID). But that would only allow the user to go back and have whatever the last tab they opened before following a link remain open.

If you want to save the state of many opened/closed vertical tabs I can't think of a solution that doesn't involve reading/writing constantly to a DB. Maybe you could get away with using cookies instead? Either way its gonna be messy.

|improve this answer|||||
  • JS is probably the best way to do this, I guess. Anyone care to help take a crack at this? I don't have the time right now, as I've moved on to another project :-/ – geerlingguy Aug 16 '11 at 2:41
  • I plan on doing this with jQuery, but don't have time to code it now; hopefully will get some time soon, and I'll post back here with the result. – geerlingguy Jan 5 '12 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.