Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem when using select2 in a multi select box field for autocomplete function

  • @smelendez

    Participant

    Hi, I am using Buddypress v14.2.1 together with BuddyPress Xprofile Custom Field Types v1.2.7 to be able to use select2 with a Multi Select Box field in user profiles.

    It seems that select2 works correctly as I get a text field in which when typing, the autocomplete function acts and recommends me some option from my list. The problem is that when I select an option, instead of being added in tag format and I can continue typing in the text field to add more options from the list, a tag containing all the options from my list is added and the text field disappears, so I can not continue adding option from my list.

    Here is my multi select box field configured to use select2 as you can see in this picture in the top right corner:
    Multi Select field

    As you can see this new picture, if I access the field and test the autocomplete filter, it seems to work correctly. But when I select an option, this happens and I can not do anything, I can not write to add new options or anything:
    select2 problem

    What could be happening? Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @dreampixel

    Participant

    Hello

    I’m just curious, but what is the “select2” supposed to do? – Is this a secondary plugin you’ve got or what is the purpose of this?

    The Xprofile fields are capable on its own to support multi-select, so I’m just a bit confused on what you’re trying to accomplish here and what the actual issue is?

    Maybe a more detailed description would make it easier to try and troubleshoot this. 🙂

    @smelendez

    Participant

    For sure! Thank you for your reply.

    Select2 offers a customisable selection box with support for search, tagging, remote datasets, infinite scrolling and many other widely used options. You can see some examples of how it works here in their documentation: Select2 Documentation

    The reason for using Select2 is to turn multi-selection options into tags, i.e. instead of having a list with all the options and do Ctrl+Click to select multiple options, I will have a search bar to filter options by typing and when selecting them, they will be added as tags. Here you can see an example: Select2 example

    I am using the BuddyPress Xprofile Custom Field Types plugin as it enables direct integration with Select2, but this is optional, as the Select2 documentation explains how to implement a multi-select field and make it compatible with Select2.

    In any case, I have tried both ways and neither worked for me. The result should be similar to the one shown in my previous reply but I have the problem I showed in previous screenshots.

    @dreampixel

    Participant

    Hello again

    Sorry for the late reply, I forgot to setup notifications on this post. 🙂

    I now see what you’re trying to do and why you would use the Select2 options (looks cool!).

    Now to my next question – what have you done to debug this? Have you tested if this is due to a compatibility issue within your current theme or with a third-party plugin maybe?

    I’ve never used the Select2 myself, but I would like to test it out myself for sure. 😀

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar