Hi.
I need load dropdown when try Update a form that content two models, the fields of my model original these load with the datas but the fields of my other model not work.
These are my tables:
voceador(idvoceador,nombre,...,iddemografico);
demografico(id,idestadocivil,idactividad,hijos,estrato);
estadocivil(id,estadocivil);
actividad(id, actividad);
All my fields load good, but my dropdowns and datepicker not work.
Any idea why?
This is my controller
public function actionUpdate($id)
{
$model= $this->loadModel($id);
$modelDemovoceador = Demograficovoceador::model()->findByAttributes(array('iddemograficovoceador' => $id));
$modelDemoactrecreativa = Demoactrecreativa::model()->findByAttributes(array('iddemoactrecreativa' => $modelDemovoceador->demoactrecreativa_iddemoactrecreativa));
$modelDemoestadocivil = Demoestadocivil::model()->findByAttributes(array('iddemoestadocivil' => $modelDemovoceador->demoestadocivil_iddemoestadocivil));
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Voceador']))
{
$model->attributes=$_POST['Voceador'];
if($model->save())
$this->redirect(array('view','id'=>$model->idvoceador));
}
$this->render('update',array(
'model'=> $model,
'modeldemovoce' => $modelDemovoceador,
'modeldemoact' => $modelDemoactrecreativa,
'modeldemocivil' => $modelDemoestadocivil,
));
}
and this is one field in my view
.
.
.
<div class="row">
<?php echo $form->labelEx($modeldemocivil,'nombredemoestadocivil'); ?>
<?php echo $form->dropDownList($modeldemocivil,'nombredemoestadocivil',$modeldemocivil->getEstadocivil(),array('prompt' => 'Seleccione...','name' => 'estadocivil'));?>
<?php echo $form->error($modeldemocivil,'nombredemoestadocivil'); ?>
</div>