select2 plugin multiple value selection

select2 plugin multiple value selection

alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0

I post a comment to the related extension but it is not seen.
if you set multiple=multiple to select value it shows the values perfectly like
x option A, x option B..
if you click x option is deselected. when you try to save this value it saves it as Array not like 2,3,4 which usually select2 saves. can you please help

This question has an accepted answers - jump to answer

Answers

  • alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0
    edited August 2015

    finally I solved the situation.

    for anybody needs help please update the documentation allan
    in js file:

    ....

    "create": function ( conf ) {
            conf._input = $('<select multiple="multiple" />')
    

    multiple tag is added .......

        "get": function ( conf ) {
            return conf._input.select2('val').toString();
        },
    
        "set": function ( conf, val ) {
            conf._input.select2( 'val', val.split(",") );
        },
    

    array functions added

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    Answer ✓

    Hi,

    Thanks for posting this - what I'll do is add an option to the plug-in that provides the option to indicate that multiple values can be used and how they should be combined (if they should be - sometimes an array can be useful!).

    It will be a few days before I do so, but I've made a note to make sure it gets done :-)

    Allan

  • alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0

    maybe adding a select2m (multiple) plugin does the trick? because we can use same select with multiple or not.

  • Denis.David@dqs.deDenis.David@dqs.de Posts: 28Questions: 8Answers: 1

    Is there any updated revision of the select2 plugin yet to support multiple values with custom separator?

    Thanks,

    Denis

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Does Select2 offer a separator option? I don't immediately see anything about that in the Select2 documentation.

    Allan

This discussion has been closed.