yii dropdownlist selected items when update

how to make the multiple dropdown list can be selected in update option ?


As I am getting the value dynamical, So, I have to make the list dynamically according to databases saved id and following yii convention…$result = Product::model()->findAllBySql($query);

                $selectedlist = CHtml::listData($result,’ProductID’, ‘ProductID’);
$x =  array();
foreach ($selectedlist as $key => $value) {
}$list=CHtml::listData( Product::model()->findAllBySql(SELECT ProductID, ProductName
FROM product ORDER BY ProductName ASC’),’ProductID’, ‘ProductName‘);

echo $form->dropDownList($model,’ClientIDs’,$list, array(  ’empty’=>’——Select multiple clients——‘,

                ‘value’ => ‘Y’,

============================== Another way==========

But, in this way, you will able to make the items selected but, that value you will not able to use, when update.

This is:

echo Chtml::dropDownList(‘ClientIDs’,$selected, $list, array(  ’empty’=>’——Select multiple clients——‘,));


3 thoughts on “yii dropdownlist selected items when update

  1. Great beat ! I would like to apprentice whilst you amend your website, how could i subscribe for a blog web site? The account helped me a appropriate deal. I had been tiny bit acquainted of this your broadcast provided vivid clear concept

  2. Pingback: white paper
  3. Hey there! Your webpage is running lagging in my situation, this took
    like a minute or so to load, I personally dont know whether or not it’s
    just me or maybe your websites although google loaded fine for
    me. However , I appreciate you for submitting brilliant article.
    I suppose it has become useful to plenty of people who came on this page.

    This is without a doubt brilliant everything that you have done here and wish to discover a lot more posts from
    your website. After viewing the articles, I’ve book-marked the website.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s