This is just the normal behavior for Gii, when creating forms (both for CRUD and only for forms), it does all the input field fields. Thus, the default gii generator and the form generator do not take relationships into account when generating the code.
We must manually make changes to the view file, namely _form.php for the model in question, this is an event for you.
Therefore, for your requirement, you can make the following changes to this file:
<div class="row"> <?php echo $form->labelEx($model, 'venue'); ?> <?php echo $form->dropDownList($model,'venue', CHtml::listData(Venue::model()->findAll(), 'id', <?php echo $form->error($model,'venue'); ?> </div>
To make further changes / settings, read more about CActiveForm .
Hope this helps.
source share