Product Support

Chosen Selector

Adds a "Chosen" Selector with an enhanced UI and auto-suggest

Product Setup

This plugin adds 4 new form element types for you to choose in Participants Database when configuring your fields on the Manage Database Fields page.

  • Chosen Dropdown – Single-select control with search and improved UI
  • Chosen Multi Dropdown – Multiple-Select control with search and tag UI
  • Chosen Dropdown/Other – Single Selector control with the ability to add a new item
  • Chosen Multi Dropdown/Other – Multiple-Select control the allows new items to be added

How to Use the Plugin

Once the plugin is activated all you need to do is select one of the new form element types in your field definition. The user messaging and other UI features may be configured in the plugin settings, in the Participants Database admin menu cluster.

Populating the Dropdown from the Database

Here is a tutorial on how to populate the Chosen Dropdown with options from the database–or any other source: Pre-load a “Chosen” Dropdown with Options from the Database

Product Settings

Selection Prompt

Message shown in the control before a selection is made.

Multi-Selection Prompt

Message shown in a multi-select control before a selection is made.

No Results Message

Message shown when using the search field and no matching selections are found.

Add Other Value Text

When “other” values are allowed, the message that is shown if the user has typed in something that doesn’t match any of the selections, suggesting that they can save it.

Disable Search Threshold

The number of items needed in a dropdown in order for the search function to be active. This is to prevent the search control from appearing when there are only a few items to select from. Has no effect on “other” form elements because the search input is where the use may type in a new value.

F.A.Q.

How do I create groups of options?

This is done in the “values” field of the field definition. A group of options is called an “optgroup” and you can define optgroups with a title like this:

Activities::optgroup

So for example, here is a list of options that have been divided into two groups:

Activity::optgroup, Sports::sports, Outdoors::outdoors, Yoga::yoga, Hobbies::optgroup, Photography::photography, Art/Crafts::crafts, Music::music, Cuisine::cuisine

That will display in the Chosen Dropdown like this:

Can the Chosen Dropdown have an "other" option?

Yes, it’s very simple to set up. In the field definition, choose “Chosen Dropdown/Other” or “Chosen Multi Dropdown/Other” depending if you want them to choose only one or let them choose several options. That gives the user the ability to type their option in and select it. It looks like this:

When using a multiselect, I can't remove the last item, it keeps coming back.

With the Chosen Multiselect Dropdown, you must define a “none” option in order to be able to clear the value. You only need to do this is you need to give your users a way to clear out all the values in a multiselect.

We do this by adding a “null_select” to the list of options, like in this example:

null_select::None

That will provide a “None” option that saves an empty value, in other words, if the user selects only “None” in the selector, any value that was stored for the field will be blanked out. This is of course not true if they choose other selections along with the “None.”

The word “None” can be anything you want. The “null_select” part tells the plugin that the field is meant to have a blank value.

Support Discussions for Chosen Selector

  • I’m not sure why get_value seems to work great for several of my field types but for this particular one it just says “Array”

    Here’s my code….

    echo $record->get_value(‘title’);
    • If you’re getting “Array” that means the data for that field is stored as an array of values. This is true for multiselect fields and also “link” fields. IF the field is none of those, you need to check your database directly to see if you’ve got array data in the values for that field for some reason. This can happen if the field type was changed after data was already placed in the field.

  • Hi Roland. I’m trying to get the Chosen Multi Dropdown to be read-only by the user so that only an admin can add it to on their end. I’ve selected Read Only, removed it from sign up, and it’s not required, but still the user is able to edit the drop down after they register. Is this a bug or am I doing something wrong?

    Thank you.

    • It looks like the readonly setting isn’t working for Chosen elements. I’ll need to issue an update to fix this.

      • Roland, thank you for the fix I saw in the update. I’m seeing a new problem that must be from the update. The chosen drop down field values are printing with a span wrap now as I believe they once did not…
        My code:

        record->print_value(‘title’)

        prints this:

        Student Worker

        This poses a few problems for my header.

        • Dang code backtick didn’t work…

          It prints this:
          Student Worker, Web and Information Designer

        • Also, if the chosen drop-down is read only it seems to disable to search function entirely on the combo multi-search front-end… All it shows is a disabled “Any” text.

          Sorry for my way too many posts today.

        • Yes, I added a span tag to that, for situations where the chosen dropdown value needs to be treated as a special case. This wouldn’t affect the layout unless you had CSS that targeted it. You may need to make sure you don’t have CSS rules that are too general and are affecting some elements unintentionally.

        • The span class wrap is fine except for if I want to include the value in the html header for SEO. I’m using job titles for this so I was displaying their name and job title respectively. I tried stripping the tags with PHP but no luck so far.

        • If you use the $record->get_value method, the value is not wrapped in a tag.

Got a Support Question?

You have to agree to the comment policy.