Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8611665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:25:55+00:00 2026-06-12T04:25:55+00:00

I am trying to use drop down list widget : $this->widget(‘ext.multiselect.JMultiSelect’,array( ‘model’=>$model, ‘attribute’=>’attribute’, ‘data’=>$data,

  • 0

I am trying to use drop down list widget :

  $this->widget('ext.multiselect.JMultiSelect',array(
      'model'=>$model,
      'attribute'=>'attribute',
      'data'=>$data,
      // additional javascript options for the MultiSelect plugin
      'options'=>array()
));

What I want to know is that Details of each option available in the widget array Like what is ‘attribute’ , ‘model’ and’data’ represent , as I an unable to understand it form the documentation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:25:57+00:00Added an answer on June 12, 2026 at 4:25 am

    The model param is the model you are creating the multi select for.

    The attribute is the model attribute you are creating the multi select for.

    The data is an array of key/value pairs for the list items you want to display in the multi select.

    For example, if you had a model ‘User’ and in that model you had a field ‘access_rights’ and you wanted to have that field as a multi select box with a few values, you might do something like:

    In your controller:

    $model = new User;
    
    $data = array(
        'admin_area'=>'Admin Area Access',
        'product_area'=>'Product Area Access',
        'customer_area'=>'Customer Area Access',
        ... etc
    );
    

    In your form in your view file:

    $this->widget('ext.multiselect.JMultiSelect',array(
        'model'=>$model,
        'attribute'=>'access_rights',
        'data'=>$data,
        // additional javascript options for the MultiSelect plugin
        'options'=>array()
    ));
    

    Edit:

    To add data to the multi select options from another model you can use the CHtml::listData() method, this takes an active record result set and converts it into an array of key/value pairs so you can use in any of the other CHtml methods that require a key/value pair. To do this you simply get the records you’re after from the database using active record, eg;

    $myData = Data::model->findAll();
    

    You can then put that into the listData() method and it’ll create your array:

    $this->widget('ext.multiselect.JMultiSelect',array(
        'model'=>$model,
        'attribute'=>'access_rights',
        'data'=>CHtml::listData($myData, 'id', 'name'),
        // additional javascript options for the MultiSelect plugin
        'options'=>array()
    ));
    

    (where ‘id’ and ‘name’ are the fields from the model table that you want to be the ‘key’ and ‘value’ within the array)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Dashcode to create a drop-down list for an iPhone Web
I am trying to make a report use a drop-down list (select list) for
I am trying to get a drop-down list to display column data containing countries
Hi guys Im trying to make a drop-down list of countries and when the
Very simple problem...but weird results. Im just trying to fill a drop down list
I have a <select> element in HTML. This element represents a drop down list.
I'm trying to initiate the drop down list click for a combobox of type
I am trying to correct the sort order of my ASP.NET drop down list.
I am trying to fill my view model with some drop down options from
I'm trying to populate a Drop down list with pharmaceutical companies, like Bayer, Medley

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.