Categories | Question details Back To List | ||
Returning To Selected Tab Sorry I sent in another question before this however I used the wrong email address to a site that I don't use that much.... I am currently using the tabbar on a reports page I created, there are 5 tabs on the page. I sometimes navigate away from reports page to another page then return to the reports only to be taken back to the default (tabbar.setTabActive("a1")) I specified, is there anyway to make it when I return to the page it go back to the last tab I was on? example: I was on reports page under TAB 2, I leave or refresh the page and come back to it and it takes me back to TAB 1, how can it go back to TAB 2? I hope this wasn't too confusing, and thanks for the awesome work! the previous email I sent from was greg@tomtimms.com FYI. Answer posted by Alex (support) on Jan 13, 2010 00:16 There are getActiveTab(tabId) and setTabActive(tabId) methods. You can call the 1st one to get id of an active tab and put it to cookie. The latter can be used to restore active tab (id should be got from cookie). Answer posted by Greg Thimmes on Jan 13, 2010 08:24 How about just loading data inside the same tab? Is that possible? Or do I have to go the route of storing it in a session or cookie? I have form that is outside the tabbar and when it submits it takes me back to the default selected tab. I just need the current active tab to stay open when the submit button is pushed. Thanks. Answer posted by Alex (support) on Jan 13, 2010 08:36 You can put the selected tab id into the hidden field and pass it to the server-side program with other data on submit. Answer posted by Greg Thimmes on Jan 13, 2010 11:16 Ok I understand this right however having a bit of an issue. I added this to my script var tab = tabbar.getActiveTab(); // setting the current tab variable document.getElementById('Tab').value=tab; //Writing variable so I can post it into a hidden form filed tabbar.setTabActive("<?echo $Tab;?>"); // setting the tab to the current tab which is selected I created a hidden form filed with <input type="hidden" id="Tab" name="Tab" value=""/> Also at the top of my document I checked to see if Tab is set. if(isset($_GET['Tab'])) { $Tab = $_GET['Tab']; } else { $Tab = "a1"; } When submitting the form it still goes right back to the default tab (a1). Sorry I am not the best with javascript so I am sorting learning on the fly here. Do I need to pass the $Tab variable to all my (iFrame-On-Demand) pages as well? Thanks for any assistance. Answer posted by Alex (support) on Jan 14, 2010 04:01 is the correct id passed on submit ? the example: <form action="" onsubmit="getActive()">... <input type="hidden" id="Tab" name="Tab" value=""/> </form> <script> ... function getActive(){ the following code should be called when all tabs are created (addTab is called for each tab) <? Answer posted by Greg Thim mes on Jan 14, 2010 05:32 Thanks for the quick response, I passed the function to the form submit field with <form action="" onsubmit="getActive()"> , however it did not work. I changed the onsubmit to onclick and tada! it works. Thanks for the assistance I hope to be purchasing a license in the near future! |