Using Chosen jQuery plugin as checkbox replacement for field with multiple values

Using Chosen jQuery plugin as checkbox replacement for field with multiple values

fmeyer@nearbysoftware.comfmeyer@nearbysoftware.com Posts: 18Questions: 5Answers: 0

Hello,

I played with the Chosen plugin for Editor found here.

It works well for a single select dropdown, but I'm failing to use it configured as a "multiple select" enabled control, which is needed to replace the Editor's "checkbox" field type for multiple values.

Am I missing the obvious?

Thanks

This question has an accepted answers - jump to answer

Answers

  • fmeyer@nearbysoftware.comfmeyer@nearbysoftware.com Posts: 18Questions: 5Answers: 0

    I did make it work using the following right after the initialisation of the editor object:

    var chosenField = $('select', editor.field('myFieldName').node());
    $(chosenField).attr("multiple", "");
    

    This seems a little like a hack to me.
    Any better solution anyone?

  • allanallan Posts: 63,195Questions: 1Answers: 10,413 Site admin
    Answer ✓

    Can you show me how you were initialising the Chosen field please? It should be that you just pass in attr: { multiple: true } to the field.

    Allan

  • fmeyer@nearbysoftware.comfmeyer@nearbysoftware.com Posts: 18Questions: 5Answers: 0

    Damn, this works fine.
    Can't figure out how I missed this one from the documentation.
    Thanks Allan.

This discussion has been closed.