I’m using symfony and I have a module “contacts” in which I’ve created two tabs “contacts” and “list of contacts”. In both tabs I have a filter and a list.
My problem is during the redirection after clicking on “filter” or “reset” in a tab.
By default when accessing on the main page, the tab “contacts” is active. Then, when I click on the tab “list of contacts” and when I use the filter, I’m redirected on the main page with the tab “contacts” active.
What I want is to pass argument in the redirection function so that when I click on the filter or reset button on the tab “list of contacts” I’m redirected on the main page contacts with the tab “list of contacts” active, and not the tab “contacts”.
Can you help me on that ?
Tell me if my problem isn’t clear enough for you guys to help me or if you need some code !
Here is my code :
<li class="menu0">
<a href="#menu_0" id="_0" class="current" onclick="multiClass(this.id)" title="menu1">Contacts</a>
</li>
<li class="menu1">
<a href="#menu_1" id="_1" class="ghost" onclick="multiClass(this.id)" title="menu1">Liste des Contacts</a>
</li>
<div id="menu_0" class="on content">
<h1></h1>
<?php include_partial('invites/filters', array('form' => $filters, 'configuration' => $configuration)) ?>
<?php include_partial('invites/list', array('pager' => $pager, 'sort' => $sort, 'helper' => $helper)) ?>
</div>
<div id="menu_1" class="off content">
<h2>-</h2>
<?php echo include_component('groupe_invite', 'liste')?>
</div>
And in my action:
$this->redirect($request->getReferer()."#menu_1");
It doesn’t work….
Thank you
EDIT:
Here is my JavaScript function:
function multiClass(eltId) {
arrLinkId = new Array('_0','_1','_2','_3');
intNbLinkElt = new Number(arrLinkId.length);
arrClassLink = new Array('current','ghost');
strContent = new String()
for (i=0; i<intNbLinkElt; i++) {
strContent = "menu"+arrLinkId[i];
if ( arrLinkId[i] == eltId ) {
document.getElementById(arrLinkId[i]).className = arrClassLink[0];
document.getElementById(strContent).className = 'on content';
} else {
document.getElementById(arrLinkId[i]).className = arrClassLink[1];
document.getElementById(strContent).className = 'off content';
}
}
}
If you are using jQuery UI for the tabs, you can add the ID of the tab to open in the URL hash:
http://www.example.com/foo/bar#tabname