Forums

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

Single select custom field behave like component section

kathleen neblett September 25, 2015

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!

3 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
September 25, 2015

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?
kathleen neblett September 28, 2015

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.

2 votes
AndrewB
Contributor
September 25, 2015

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.

kathleen neblett September 29, 2015

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

AndrewB
Contributor
September 29, 2015

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.

kathleen neblett October 2, 2015

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

Junio Fernandes
Contributor
July 23, 2020

@AndrewB worked in Jira 7.11.2. Tks!

0 votes
summerke October 10, 2018

I found that this script worked for one field, that had just text options, but when I had things like below (it didn't work). Any ideas?

A.1.a - commercial 

A.2.a - worker

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events