Hello, I’m confused about easy thing. I have a dropdown list like that:
<?php $collect = collections::model()->findAll(); ?> <?php echo CHtml::activeLabelEx($model,'Колекція'); ?> <?php echo CHtml::activeDropDownList($model, 'collectid', CHtml::listData($collect , 'collectid', 'nameua')); ?>
But I can’t add empty element to the list which would set collectid as NULL and return it to table ‘model’.
Possible way is to create some collection in the table ‘collections’ with defined collectid, smth. like: collectid = 999 and then check returned value in controller and if it would be 999 set it as NULL and then save it into table ‘model’. But it doesn’t seem to be good idea. Tables look like that:
collections: collectid nameua model: modelid name collectid