Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we have a multi-select field with auto-complete for more than one selection?

Deleted user January 8, 2019

2 answers

0 votes
Karanpreet Kaur
Contributor
October 27, 2020

This solution (https://confluence.atlassian.com/jirakb/how-to-enable-autocomplete-renderer-for-multi-select-custom-field-in-jira-754978239.html) only works if the option "Enable HTML in custom field descriptions and list item values" in "General Configuration" settings is turned ON. It is OFF by default in the latest versions of JIRA.

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 14, 2019

Hello Jennifer,

The Auto-Complete feature can be achieved by using some JavaScript syntax on your issues fields.

For a Multi-Select Custom field, you can check the explanation of Benji below:

Adding Auto-Complete to a Select list

Basically, these would be the steps:

1) Create a custom field that uses a multi-select list

2) Paste the following code in the description field of your custom field:

<script type="text/javascript">
(function($) {
  
 // "customfield_10400" is the number of the custom 
 // multiselect field you want to change as e.g. 
 // seen at the end of the "configure" page url of 
 // the field you want to change this way 
  
    AJS.$("#customfield_10400 option[value='-1']").remove(); //Removes the default value "None"
    function convertMulti(id){
        if (AJS.$('#'+id+"-textarea").length == 0){
            new AJS.MultiSelect({
                element: $("#"+id),
                itemAttrDisplayed: "label",
                errorMessage: AJS.params.multiselectComponentsError
            });
  
        }
    }
  
    AJS.toInit(function(){   
        convertMulti("customfield_10400");
    })
  
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
        AJS.$("#customfield_10400 option[value='-1']").remove();
        convertMulti("customfield_10400");
    });
  
})(AJS.$);
</script>

Let me know if it works for you.

Daniel Alonso
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2020

How can I apply this solution to Cloud?

Alexey Osipov July 1, 2022

@Petter Gonçalves 

Hi, any ideas why inline editing is not working for such custom field adjusted to autocomplete with a script?Inline editing.JPG

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events