echo $form->labelEx($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'name'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'stations'); ?> <?php $data = CHtml::listData(Stations::model()->findAll(), "id", "name"); echo $form->dropDownList($model, 'stations', $data, array('multiple' => 'multiple', 'size' => '5')); ?> <?php echo $form->error($model, 'stations'); ?> </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 the ID of the model to be loaded */ public function loadModel($id) { $model = Stations::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->labelEx($model, 'seat_id'); ?> <?php echo $form->dropDownList($model, 'seat_id', CHtml::listData(Seats::model()->findAll(), 'id', 'name'), array('prompt' => 'Select a seat')); ?> <?php echo $form->error($model, 'seat_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'station_id'); ?> <?php echo $form->dropDownList($model, 'station_id', CHtml::listData(Stations::model()->findAll(), 'id', 'name'), array('prompt' => 'Select a station')); ?> <?php echo $form->error($model, 'station_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>