Yii 1.1: activetabview

EActiveTabView allow us to keep track of the actual selected tab inside a form...

This extension works in similar fashion to CTabView, but is intended to be used inside a form. This extension adds a single hidden field in wich value's is stored the actual selected tab. So, in our controller we can ask for that field to know the actual selected tab.




  • Yii 1.0.3 or above


  • Extract the release file under protected/extensions


The usage is the same of the CTabView, except that we must specify the name of the hidden field (or model/attribute):

In our view:

<div class="yiiForm">
<?php echo CHtml::form(); ?>
<?php echo CHtml::errorSummary($someModel); ?>
<div class="simple">
<?php echo CHtml::activeLabelEx($someModel,'attr1'); ?>
<?php echo CHtml::activeTextField($someModel,'attr1'); ?>
<div class="simple">
<?php echo CHtml::activeLabelEx($someModel,'attr2'); ?>
<?php echo CHtml::activeTextField($someModel,'attr2'); ?>
   $Tabs = array(...);  
   $viewData = array(...);
   // OR
<div class="action">
<?php echo CHtml::submitButton(); ?>
<?php echo CHtml::closeTag('form'); ?>
</div><!-- yiiForm -->

So in our controller we can do the following:

public function actionUpdate()
   $someModel=new SomeModel;
      // In the case that we specify model/attribute.
      // $someModel->attr3 has the ID of the actual selected tab
      // OR, in the case that we specify the name.
      $selectedTab = $_POST['someName'];
      // $selectedTab has the ID of the actual selected tab
      // do ther stuff
   // render view, etc,etc

Change Log

March 27, 2009

  • Initial release.

Total 2 comments

#209 report it
Deimos at 2010/08/08 07:26am
not work

I haste. Selected tab is ok, but not work changing tabs. ???

#210 report it
Deimos at 2010/08/08 07:06am

That is exactly what I'm looking for

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: PoL
  • Category: User Interface
  • Votes: -2
  • Downloaded: 599 times
  • Created on: Mar 27, 2009
  • Last updated: Mar 27, 2009