Buenas…
resulta q desarrollando un formulario para subir una imagen de acuerdo a un id de seccion he puesto lo siguiente:
<?php echo $form->labelEx($model,'Seccion'); ?>
<?php echo $form->dropDownList($model,'id_seccion',array(1=>"Inicio", 2=>"Nuestra Empresa", 3=>"Servicios", 4=>"Productos", 5=> "Nuestros Clientes")); ?>
<?php echo $form->error($model,'seccion'); ?>
en el momento de enviar el formulario, obtengo un error de
resulta q el mismo modo para gestionar unos post, funciona a las mil maravillas. poniendo las tablas y las relaciones como se maneja en yii tengo:
para post
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'author' => array(self::BELONGS_TO, 'User', 'author_id'),
'seccion' => array(self::BELONGS_TO, 'Seccion', 'id_seccion'),
);
}
para banner
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'seccion' => array(self::BELONGS_TO, 'Seccion', 'id_seccion'),
);
}
y en las reglas tengo
para post
return array(
array('title, content, status, id_seccion', 'required'),
array('status, id_seccion, create_time, update_time, author_id', 'numerical', 'integerOnly'=>true),
array('title', 'length', 'max'=>128),
array('tags', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, title, content, tags, status, id_seccion, create_time, update_time, author_id', 'safe', 'on'=>'search'),
);
para banner
return array(
array('imagen, id_seccion', 'required'),
array('id_seccion', 'numerical', 'integerOnly'=>true),
// this will allow empty field when page is update (remember here i create scenario update)
array('imagen', 'file','types'=>'jpg, gif, png', 'allowEmpty'=>true, 'on'=>'update'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id_banner, id_seccion', 'safe', 'on'=>'search'),
);
mi pregunta es ¿por q me genera el error de validacion de id_seccion siendo q en post funciona sin problema alguno?