Hello.
I have one CJuiTabs with multiple tabs.
My problem is in different tabs using the same model. In the first tab, I update the model and the second tab I create a new record in the database.
My code is:
<div class="form">
<?php
$form=$this->beginWidget(‘CActiveForm’,array(
'id'=>'default-parent-form',
'enableAjaxValidation'=>false,
));
?>
<?php
$tabs[‘Dados Pessoais’]=array(
'id'=>'DadosPessoais',
'content'=>$this->renderPartial('_formPag1',array(
'form'=>$form,
'model1'=>$model1,
'model2'=>$model2,
'colaborador'=>$colaborador,
),
true)
);
$tabs[‘Competências’]=array(
'id'=>'Competências',
'content'=>$this->renderPartial('_formPag2',array(
'form'=>$form,
'items'=>$itemsCompet,
'modelCompet'=>$modelCompet,
'compet'=>$compet,
),
true)
);
$tabs[‘Objectivos Ano Anterior’]=array(
'id'=>'ObejctivosAnoAnterior',
'content'=>$this->renderPartial('_formPag3',array(
'form'=>$form,
'items'=>$items,
'modelObj'=>$modelObj,
),
true)
);
$tabs[‘Novos Objectivos’]=array(
'id'=>'DefinirObjectivos',
'content'=>$this->renderPartial('_formPag4',array(
'form'=>$form,
'obj'=>$obj,
),
true)
);
$tabs['Acção de Formação']=array(
'id'=>'Formação',
'content'=>$this->renderPartial('_formPag5',array(
'form'=>$form,
'forma'=>$forma,
'pif'=>$pif,
),
true)
);
$tabs['Resultado']=array(
'id'=>'resultado',
'content'=>$this->renderPartial('_formPag6',array(
'form'=>$form,
),
true)
);
$tabs['Comentários']=array(
'id'=>'Comentários',
'content'=>$this->renderPartial('_formPag7',array(
'form'=>$form,
'momento'=>$momento,
),
true)
);
$this->widget('zii.widgets.jui.CJuiTabs',array(
'tabs'=>$tabs,
'options'=>array(
'collapsible'=>false,
),
));
?>
<br>
<div style="margin-left: 930px">
<?php
$this->widget(‘zii.widgets.jui.CJuiButton’,array(
'name'=>'submit',
'caption'=>'Enviar',
'htmlOptions'=>array(
'style'=>'background:#006600;color:#ffffff;',
),
));
?>
</div>
<?php $this->endWidget(); ?>
</div>
In the tab Goals Last Year I update this data and in the tab New Goals I create the new Goals, but in the first tab I use tabular input for to save the data.
The problem is when i try save the model simultaneous.
I try this wiki http://www.yiiframework.com/wiki/472/use-a-form-and-cgridview-in-separate-cjuitabs-with-same-or-multiple-models-and-submit-all-cjuitabs-simultaneously/, but I can’t save the data.
Please a need help.
Sorry my bad English.
Thank You for your attention!