dropdown list values from othermodel

Making and dropDownList in search form.

_search.php now contain:

<?php echo $form->dropDownList($model,‘loginid’,CHtml::listData(Login::model()->findAll(), ‘id’,‘login’));?>

<?php echo $form->dropDownList($model,‘loginid’,CHtml::listData(Login::model()->findAll(), ‘id’,‘passwd’));?>

It shows 2 lists but works only last one. I want to push this lists to model together. How can i do that ?

Both lists set $model->loginid !!!

You can merge the arrays for one list, but as mdomba pointed out, you’re only going to be searching loginid

<?php echo $form->dropDownList($model,‘loginid’,CHtml::listData(Login::model()->findAll(), ‘id’,‘login’));?>

<?php echo $form->dropDownList($model,‘loginid’,CHtml::listData(Login::model()->findAll(), ‘id’,‘passwd’));?>

u using The loginid ID in both so last overwrite with last thought have to keep name Seprate And define Other Name Attribute In Model

class

then work Smoothly try it…

Try:


<?php echo $form->dropDownList($model,'loginid',CHtml::listData(Login::model()->findAll(), 'id','login'));?>

<?php echo $form->dropDownList($model,'passwd',CHtml::listData(Login::model()->findAll(), 'id','passwd'));?>




Matbe?