/** * 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 = InternationalCompanyService::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'international-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'service_id'); ?> <?php echo $form->dropDownList($model, 'service_id', CHtml::listData(InternationalCompanyService::model()->findAll(), 'id', 'name'), array('prompt' => '-- select service --')); ?> <?php echo $form->error($model, 'service_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'type'); ?> <?php echo $form->dropDownList($model, 'type', $model->type(), array('prompt' => '-- select type --')); ?> <?php echo $form->error($model, 'type');