echo $form->dropDownList($model, 'categoria_id', CHtml::listData(Categoria::model()->findAll(), 'categoria_id', 'categoria_nombre'), array('empty' => 'Seleccione Categoría')); ?> <?php //echo $form->textField($model,'categoria_id',array('size'=>20,'maxlength'=>20)); ?> <?php echo $form->error($model, 'categoria_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'unidad_venta_id'); ?> <?php echo $form->dropDownList($model, 'unidad_venta_id', CHtml::listData(UnidadVenta::model()->findAll(), 'unidad_venta_id', 'unidad_venta_nombre'), array('empty' => 'Seleccione Categoría')); ?> <?php //echo $form->textField($model,'unidad_venta_id',array('size'=>20,'maxlength'=>20)); ?> <?php echo $form->error($model, 'unidad_venta_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = UnidadVenta::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }