populating a dropdown list based on the selection in another dropdown.

In my JIRA gadget i have two dropdowns. I need to populate dropdownB based on the selection in dropdownA. Currently i have used dropdownA.onchange event and that event is not triggered.

where should I place the code so that the even is captured? config/view/script?

Currently I have placed this code in the script section, which is it working when I realod the page.

<script>                     
chipNames.onchange = function(){ setTimeout(function(){}, 1); var selectedChip = chipNames.options[chipNames.selectedIndex].text; if (selectedChip !== "" && selectedChip !== '-1') { boards.options.length = 0; AJS.$.ajax({ url: "/rest/testresults-gadget/1.0/test-results-data/getOptions", data:{chips:selectedChip}, dataType:"json", success:function(data){ var lists = data.boardNamesForTests; var boardOptions = document.createElement('options'); boardOptions.text = " "; boardOptions.value = " "; boards.add(new Option(boardOptions.value,0)); for(var i = 0; i < lists.length; i++){ boardOptions.text = lists[i].label; boardOptions.value = lists[i].value; boards.add(new Option(boardOptions.value,0)); } } }); } }

</script>

Please help

2 answers

This widget could not be displayed.

Have you tried using a cascading select list instead of a javascript bodge?

This widget could not be displayed.

how to use cascading select list ? are there any reference code

Neelu -

I have the similar requirement in our environment. Would you mind sharing the solution with us ?

Thanks

I suspect Neelu added a cascading select list via admin -> custom fields.

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 Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

147 views 16 7
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