Admin Tab problem

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kube
Forum Members
Forum Members
Posts: 29
Joined: Sun Jan 03, 2010 10:34 am
Location: Belgium

Admin Tab problem

Post by kube »

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:

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());
And later in the php file i have forms defined as such:

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());
and (for tab2)

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());
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 ? :-\
Post Reply

Return to “Developers Discussion”