Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript tabs symfony redirection
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>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".</p> <p>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 !</p> <p>Here is my code :</p> <pre><code> &lt;li class="menu0"&gt; &lt;a href="#menu_0" id="_0" class="current" onclick="multiClass(this.id)" title="menu1"&gt;Contacts&lt;/a&gt; &lt;/li&gt; &lt;li class="menu1"&gt; &lt;a href="#menu_1" id="_1" class="ghost" onclick="multiClass(this.id)" title="menu1"&gt;Liste des Contacts&lt;/a&gt; &lt;/li&gt; &lt;div id="menu_0" class="on content"&gt; &lt;h1&gt;&lt;/h1&gt; &lt;?php include_partial('invites/filters', array('form' =&gt; $filters, 'configuration' =&gt; $configuration)) ?&gt; &lt;?php include_partial('invites/list', array('pager' =&gt; $pager, 'sort' =&gt; $sort, 'helper' =&gt; $helper)) ?&gt; &lt;/div&gt; &lt;div id="menu_1" class="off content"&gt; &lt;h2&gt;-&lt;/h2&gt; &lt;?php echo include_component('groupe_invite', 'liste')?&gt; &lt;/div&gt; </code></pre> <p>And in my action:</p> <pre><code> $this-&gt;redirect($request-&gt;getReferer()."#menu_1"); </code></pre> <p>It doesn't work....</p> <p>Thank you</p> <p><strong>EDIT:</strong></p> <p>Here is my JavaScript function:</p> <pre><code>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&lt;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'; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload