how to add auto complete rendere to any custom field

what should i do, to add auto complete to any of my custom field. Any idea..?

I cannot see even auto complete renderer in drop down in field configuration drip down where we have

1. Default text renderer and

2. Wiki Type renderer

Please suggest.

7 answers

1 accepted

This widget could not be displayed.

Hi, this isn't currently available. You cannot select it for custom fields. What type of custom field are you trying to create? A select list?

You can inject some javascript in the description to get this to work for select/multi-select fields.

I have two scenarios:

1. I already have custom field which iis of type JIRA Multiple Database Field (Can query a database and list the results for selection in an issue) and now i need to change it to auto complete

2. I want to create a fresh custom field, so how can i make it "auto-complete" simlar to what we have in "components" field in JIRA.

My sole motive is to creata "auto-complete" custom field..!! so if you can tell me any possible way or scenario through which i can implement it . I will be more th a happy.

I hope i am clear to you..

Thanks

Here is the code we used to get multi-select lists working to look like the new autocomplete renderer:

<script type="text/javascript">
(function($) {
    AJS.$("#customfield_<id> 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_<id>");
    })
 
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
        AJS.$("#customfield_<id> option[value='-1']").remove();
        convertMulti("customfield_<id>");
    });
})(AJS.$);
</script>

It goes in the description field in the field configuration of a customfield. Replace the customfield id with your own one. I won't take credit for this. We found this post by another user earlier.

Still not able to figure out..

can you please have a look at attached screenshots..

where i am missing .??

it would be really greatful.

Thanks

What do you get on the screen where you try to enter data for this field? What shows up?

oops.. i think we can add only 3 attachments here as i added five..!!

neways what i get on my create issue screen is as follows:

Kindly suggest.!!!

This widget could not be displayed.
Successfully used this as field description
Provides "None" value, which disappears when selecting any (or multiple) other value(s), and re-appears when removing all previously select values
Can be used multiple times in a single page (multiple multi-select fields with same script as description)
 
Single issue found :
if you are on the [jira-instance]/secure/CreateIssue.jspa page AND if you click "Create issue" on top right of the screen, the concerned fields just become non-working fields.
<script type="text/javascript">
jQuery(document).ready(function(){
	console.log('Loaded');
	jQuery.getScript('http://cdnjs.cloudflare.com/ajax/libs/chosen/0.9.12/chosen.jquery.min.js', function(data, textStatus, jqxhr) {
   	jQuery("select[id^='customfield'][multiple='multiple'] option[value=-1]").html('Aucun'); // replace Label for "None" when necessary
	jQuery("select[id^='customfield'][multiple='multiple']").data('chosen', null);
	jQuery("select[id^='customfield'][multiple='multiple']")
		.chosen({no_results_text: "Aucun résultat : ", placeholder_text_multiple: " ", single_backstroke_delete: true})
		.change(function() {if (jQuery(this).val()!=null)
			{
				if(jQuery(this).val().length>1 && jQuery(this).val()[0] == '-1'){jQuery('#'+jQuery(this).attr("id")+' option[value=-1]').removeAttr("selected").trigger("liszt:updated");}}
				else{jQuery('#'+jQuery(this).attr("id")+' option[value=-1]').attr("selected", "selected").trigger("liszt:updated");
			}
		});
});
	if(jQuery("body").size()>0){if (document.createStyleSheet){document.createStyleSheet('http://cdnjs.cloudflare.com/ajax/libs/chosen/0.9.12/chosen.css');}
    else {jQuery("head").append(jQuery("<link rel='stylesheet' href='http://cdnjs.cloudflare.com/ajax/libs/chosen/0.9.12/chosen.css' type='text/css' media='screen' />"));}}

});
</script>

Successfully used this as field description

Provides "None" value, which disappears when selecting any (or multiple) other value(s), and re-appears when removing all previously select values

Can be used multiple times in a single page (multiple multi-select fields with same script as description)

Single issue found :

if you are on the [jira-instance]/secure/CreateIssue.jspa page AND if you click "Create issue" on top right of the screen, the concerned fields just become non-working fields.

This widget could not be displayed.

Hi,

Take a look at https://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.databasecf

It provides the autocomplete functionality out of the box.

This widget could not be displayed.

@Harry Chan, your comment was very useful indeed . Thanks

This widget could not be displayed.

THank s guys, although was not able to figure out exact answer but management has chnaged the requirement.

So now I do not need it as of now..!! But wil definitely post its answer very soon as I am digging things here and there only. Forget to close it before. Apologies for that

Thanks for the efforts and suggestions . It made me true fan for atlassian answers club.

This widget could not be displayed.
test anser your own question as i want to close it. one of the solution suggested by Atlassian to close the question is : ->Answer your own question, then accept your answer (find the 'Answer my own question' link underneath your question) but still I am not able to, can anyone help?
This widget could not be displayed.

hi all,

i am trying to use the same script to work for me. I copied the same script above and pasted in the field description box. and replaced custom_<id> with my own custom_field id. But it is not working after re-indexing. please help.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

195 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you