Hi,
If I have a controller action that combines some models into one form…
$form = new CForm('application.views.crm.createForm');
//list of models to be included in CRM page
$form['clientCompanies']->model = new ClientCompanies;
$form['clientCompaniesType']->model = new ClientCompaniesType;
$this->render('crm', array('form'=>$form));
with the createForm view looking like this
return array(
'elements'=>array(
'clientCompanies'=>array(
'type'=>'form',
'title'=>'Companies',
'elements'=>array(
'name'=>array('type'=>'text'),
'street_number'=>array('type'=>'text'),
'street_address'=>array('type'=>'text'),
'suite'=>array('type'=>'text'),
'city'=>array('type'=>'text'),
'state'=>array('type'=>'text'),
'zip'=>array('type'=>'text'),
'website'=>array('type'=>'text'),
'hours_of_operation'=>array('type'=>'text'),
),
),
'clientCompaniesType'=>array(
'type'=>'form',
'title'=>'Company Type',
'elements'=>array(
'label'=>array('type'=>'text')
),
),
and crm.php containing jui widget… all works fine for one tab.
<?php
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
'StaticTab 1' => $form
),
)
)
?>
but if I try and split it
'tabs'=>array(
'Tab 1' => $form['clientCompanies'],
'Tab 2' => $form['clientCompaniesType'],
),
it crashes with no error.
I assumed that as I had declared $form to contain
$form['clientCompanies']->model = new ClientCompanies;
$form['clientCompaniesType']->model = new ClientCompaniesType;
it would be correct to access the subfoms as above, which I can when I use CDumpVars to see what’s inside. I must be missing something with render(). Would any one be able to explain the correct way this works?
Thanks