Hi! my questions its simple: multimodelform dont work with scenearios?
i defined my scenario in my model, in RULES, like this:
array('nombre_seccion, id_sala_ciclo_anio, id_nivel, id_seccion, alu_mat_tot, alu_mat_var, id_turno, asistencia_medica, id_localizacion', 'required' , 'on'=>'adulto'),
then in my AdultoController, in actionCreate :
public function actionCreate() {
Yii::import('ext.multimodelform.MultiModelForm');
$id=Yii::app()->user->id;
$establecimientousuario = UsuEstPla::model()->find('id_usuario = :id_uno',array(':id_uno'=>$id));
$establecimiento = Establecimiento::model()->find('id_establecimiento = :id_uno',array(':id_uno'=>$establecimientousuario->id_establecimiento));
$responsable = Responsable::model()->find('id_responsable = :id_est', array(':id_est'=>$establecimiento->id_responsable));
$model = new Planilla;
$detallePlanilla = new DetallePlanilla('adulto');
$validatedDetalles = array();
if(isset($_POST['Planilla']))
{
//validate detail before saving the master
$detailOK = MultiModelForm::validate($detallePlanilla,$validatedDetalles,$deleteItems);
if ($detailOK && empty($validatedDetalles))
{
Yii::app()->user->setFlash('error','No detail submitted');
$detailOK = false;
}
if(
$detailOK &&
$model->save()
)
{
//the value for the foreign key 'groupid'
$masterValues = array ('id_planilla'=>$model->id_planilla);
if (MultiModelForm::save($detallePlanilla,$validatedDetalles,$deleteItems,$masterValues))
$this->redirect(array('admin','id'=>$model->id_planilla));
}
}
$this->render('create',array(
'model'=>$model,
'detallePlanilla'=>$detallePlanilla,
'validatedDetalles' => $validatedDetalles,
'establecimiento' => $establecimiento,
'responsable'=> $responsable
));
}
but when I try to save the data does not validate $detallePlanilla
I download the demo of multimodelform and I Modify the code to use the scenario and did not work
any suggestions?