Single select custom field behave like component section

Hello,

I've tried following the scripts in these questions:

https://answers.atlassian.com/questions/223068

https://answers.atlassian.com/questions/43534

I'm still not getting any results. Is there more than just entering the script into the description field and updating the custom field ID?

Thanks!

2 answers

1 accepted

This widget could not be displayed.

Those two questions are ancient and irrelevant to newer versions of JIRA (especially as the ability to run dodgy javascript as part of fields is being reduced because it breaks so much and so often)

Could you explain what you mean by "custom field behave like component section"?  What are you looking for? 

e.g.

  • For it to behave like a multi-select?  (You'll need to start with a multi-select cf to start on that one)
  • For it to appear somewhere else on issue view?
  • For it to be maintainable by project admins?

Currently my single select custom field has a list with all the available options, but I would like to have it appear like the component field so the user can start typing and have relevant options appear.

This widget could not be displayed.

This works for me on a Custom Field of type Select List (multiple choices) - make sure to put this: on the Field Configuration, on the Custom Field, click edit, put the following JavaScript in the Description. Earlier versions of JIRA let me use it directly on the Custom Field description, but after a recent upgrade I had to make sure to use it on the Field Configuration.

 

<script type="text/javascript">
	AJS.$("#customfield_10698 option[value='-1']").remove();
	(function($){
		new AJS.MultiSelect({
      		element: $("#customfield_10698"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError
   		});
	})(AJS.$);
</script>

 

Make sure to edit the Custom FIeld ID in the two spots in the JavaScript to match your custom field id value.

 

Hope it helps.

I'm on JIRA 6.4 and this script does not work for me.

I'm also on 6.4. Did you make sure to change the occurrences of "customfield_#####" to whatever your custom field id is? Did you place this script on the "Field Configuration" description for the custom field instead of directly on the custom field's description? One issue w/ this script is that it will only work if the issue type is first selected, it won't render if you have to change the issue type in order to see this field.

The field is not issue type dependent and both field IDs are changed in the configuration description.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

81 views 1 0
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