Admin Tab problem
Posted: Mon Aug 22, 2011 2:04 am
Hello there,
I'm having a little problem with my module's admin's tabs. In each tab, i have a form that, when submitted, sends a 'active_tab' parameter. The param is correct in the $params array but my tabs do not respond accordingly. Actually, when tab_2 should be active, it seems to glitch and switch back on tab_1..
So here's a sample of my code:
And later in the php file i have forms defined as such:
and (for tab2)
What the hell am i doing wrong ? Note that in the rest of the code i do some simple db queries that work ^pretty well. no redirection or anything like that...
Erm....help ?
I'm having a little problem with my module's admin's tabs. In each tab, i have a form that, when submitted, sends a 'active_tab' parameter. The param is correct in the $params array but my tabs do not respond accordingly. Actually, when tab_2 should be active, it seems to glitch and switch back on tab_1..
So here's a sample of my code:
Code: Select all
/* TABS */
if(!empty($params['active_tab']))
{
$tab = $params['active_tab'];
}
else
{
$tab = '';
}
echo $tab."<br/>";
$tab_headers = $this->StartTabHeaders().
$this->SetTabHeader('tab_1','Packaging', ($tab == 'tab_1')).$this->SetTabHeader('tab_2','Needs', ($tab == 'tab_2')).$this->EndTabHeaders().$this->StartTabContent();
$smarty->assign('tab_headers', $tab_headers);
$smarty->assign('StartTab_packaging', $this->StartTab('tab_1', $params));
$smarty->assign('StartTab_needs', $this->StartTab('tab_2', $params));
$smarty->assign('EndTab', $this->EndTab());
$smarty->assign('tab_footers', $this->EndTabContent());
Code: Select all
$smarty->assign('form_date_packaging_start', $this->CreateFormStart($id, 'defaultadmin', $returnid, 'post', '', 'false', '', array('active_tab'=>'tab_1')));
$smarty->assign('input_date_packaging', $this->CreateLabelForInput($id,'date_input_packaging','Date :').$this->CreateInputText($id, 'date_input_packaging',$packaging_day));
$smarty->assign('submit_date_packaging', $this->CreateInputSubmit($id, 'date_submit_packaging','Update'));
$smarty->assign('form_date_packaging_end', $this->CreateFormEnd());
Code: Select all
$smarty->assign('form_date_needs_start', $this->CreateFormStart($id, 'defaultadmin', $returnid, 'post', '', 'false', '', array('active_tab'=>'tab_2')));
$smarty->assign('input_date_needs', $this->CreateLabelForInput($id,'date_input_needs','Date :').$this->CreateInputText($id, 'date_input_needs',$needs_day));
$smarty->assign('submit_date_needs', $this->CreateInputSubmit($id, 'date_submit_needs','Update'));
$smarty->assign('form_date_needs_end', $this->CreateFormEnd());
Erm....help ?
