echo $form->dropDownList($model, 'snmp_template_id', CHtml::listData(SnmpTemplate::model()->findAll(), 'id', 'name'), array('empty' => '')); ?> <?php echo $form->error($model, 'snmp_template_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'snmp_field_id'); ?> <?php //echo $form->textField($model,'snmp_field_id'); ?> <?php echo $form->dropDownList($model, 'snmp_field_id', CHtml::listData(SnmpField::model()->findAll(), 'id', 'label'), array('empty' => '')); ?> <?php echo $form->error($model, 'snmp_field_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget();
/** * 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 $id the ID of the model to be loaded * @return SnmpField the loaded model * @throws CHttpException */ public function loadModel($id) { $model = SnmpField::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }