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

  1. Documentation
  2. Change Log

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.

Resources ¶

Documentation ¶

Requirements ¶
  • Yii 1.0.3 or above
Installation ¶
  • Extract the release file under protected/extensions
Usage ¶

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>
<div class="simple">
<?php echo CHtml::activeLabelEx($someModel,'attr2'); ?>
<?php echo CHtml::activeTextField($someModel,'attr2'); ?>
</div>

<?php
   $Tabs = array(...);	
   $viewData = array(...);
   
   $this->widget(
      'application.extensions.ActiveTabView.EActiveTabView',
      array(
         'tabs'=>$Tabs,
         'viewData'=>$viewData,
         'model'=>$someModel,
         'attribute'=>'attr3'
   ));
   
   // OR
   
   $this->widget(
      'application.extensions.ActiveTabView.EActiveTabView',
      array(
         'tabs'=>$Tabs,
         'viewData'=>$viewData,
         'name'=>'someName'
   ));


?>

<div class="action">
<?php echo CHtml::submitButton(); ?>
</div>

<?php echo CHtml::closeTag('form'); ?>
</div><!-- yiiForm -->

So in our controller we can do the following:

public function actionUpdate()
{
   $someModel=new SomeModel;
   
   if(isset($_POST['SomeModel']))
   {
      // In the case that we specify model/attribute.
      $someModel->attributes=$_POST['SomeModel'];      
      // $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.
0 2
1 follower
601 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Tags:
Developed by: PoL PoL
Created on: Mar 27, 2009
Last updated: 16 years ago

Downloads

show all