Under certain circumstances I would like to redirect the user to the second tab on a page, that is, the ‘account’ tab.
I have tried:
$this->redirect('mycontroller/myaction#account"); $this->redirect(array( 'controller' => 'mycontroller', 'action' => 'myaction', '#' => 'account' )); $this->redirect(array( 'controller' => 'mycontroller', 'action' => 'myaction#account' )); $this->redirect(array( 'action' => 'myaction#account' )); $this->redirect(array( 'action' => 'myaction', '#' => 'account' ));
None of which work; you end up on the User tab. (The call is from within MyController, so controller should be optional.)
The important bits from the ctp file:
<ul class="nav nav-tabs" style="clear:both;" id="tabs"> <li class="active"><a href="#user-data">User</a></li> <li><a href="#account">Account</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="user-data"> ... </div> <div class="tab-pane form-horizontal container-fluid" id="account"> ... </div> </div>
Searching online I have found discussions on how to do this from javascript (dealing with the ‘active’ class), but nothing for Controller::redirect().
Can it be done? How?