/** * 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 = Floors::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> <div class="row"> <?php echo $form->labelEx($model, 'tbl_room_name'); echo $form->textField($model, 'tbl_room_name', array('size' => 45, 'maxlength' => 45)); echo $form->error($model, 'tbl_room_name'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'tbl_floors_idtbl_floor'); ?> <?php $models = Floors::model()->findAll(array('order' => 'tbl_floor_name')); $list = CHtml::listData($models, 'idtbl_floor', 'tbl_floor_name'); echo CHtml::dropDownList('Rooms[tbl_floors_idtbl_floor]', $model->tblFloorsIdtblFloor, $list); echo $form->error($model, 'tbl_floors_idtbl_floor'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>