QTabs selected tab index
Wed, 03/16/2011 - 09:35
Hi!
I have some problem with QTabs, I can't get current selected tab index. The code I have looks like this
<?php
require('includes/configuration/prepend.inc.php');
class TabForm extends QForm {
public $tabPanel;
public $tabPnlSectOne;
public $tabPnlSectTwo;
public $tabPnlSectThree;
protected function Form_Create() {
parent::Form_Create();
$this->tabPanel = new QTabs($this, "TabInterface");
$this->tabPanel->AddAction(new QTabs_SelectEvent(), new QAjaxAction('QTabs_Selected'));
if(isset($_GET['id'])){
$this->tabPnlSectOne=new OnePanel($_GET['id'], $this->tabPanel, "TabOne".$_GET['id']);
}
else {
$this->tabPnlSectOne=new OnePanel("new", $this->tabPanel, "Tabnew");
}
if(isset($_GET['id'])){
$this->tabPnlSectTwo=new TwoPanel($_GET['id'], $this->tabPanel, "TabTwo".$_GET['id']);
$this->tabPnlSectThree=new ThreePanel($_GET['id'], $this->tabPanel, "TabThree".$_GET['id']);
}
$this->tabPanel->Headers = array("One", "Two", "Three");
} // Form_Create() end
public function QTabs_Selected($strFormId, $strControlId, $strParameter) {
QFirebug::Log($this->tabPanel->Selected);
}
} // TabForm end
TabForm::Run('TabForm', 'TabForm.tpl.php');
?>In Firebug I always get NULL as value. Also I tried $this->tabPanel->Option("Selected") but the result was same. (the id parameter is set, so all three tabs are shown)

Hi wizard,
The current version of QTabs does not have this functionality. I just created a ticket for it, and attached a patch that provides a solution.
http://trac.qcu.be/projects/qcubed/ticket/713
I would appreciate if you could test it out and report back.
Thanks.
-Vartan
Hi Vartan!
I tested the patch, and it works! :)
It returns the clicked tab index now.
Thank you!
Thanks wizard,
BTW, I've updated the patch with a small fix. If you've tried the earlier version, please get the new one.
OK, I've updated my QTabs, everything works fine!
Thanks again Vartan!