When dealing with bootstrap's tabs I prefer to handle which tabs should be displayed on the front-end using only JS and the URL hash fragment. That way, the only thing that manages the "state" of the view is the URL.
Basically, I have some JS that listens for changes to the hash fragment and displays the appropriate tab based on the hash fragment's value - much like a simple JS router. Based on the value of your hash you should then be able to determine which tab/pane is currently active. When the page loads I just make sure I call the same method as the hash change event so that the appropriate tab content is displayed by default. -Vincent On Tue, Mar 4, 2014 at 9:15 AM, Jonathan Vanasco <[email protected]>wrote: > Wondering if anyone else has run into this... > > I have some forms in bootstrap that are in "tab-panes". In order to > handle a form re-print, one needs to show the tab by specifying an "active" > css class on the "tab" and "tab-pane" (or triggering a js action). The > name of the 'active' tab/pane set is needed. > > The easiest way I thought of handling this is to have a Pylons-style > AttribSafeObject on the request and set a 'tab_active' attribute. > > That works fine, I'm just wondering if anyone else has encountered this > need and came up with a better solution. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/groups/opt_out. > -- Vincent Catalano Software Engineer and Web Ninja, (520).603.8944 -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/groups/opt_out.
