On selection of dropdown value how to make visible another field (dropdown)?

Hi Folks,

Can somebody help me on this.

I have a create issue screen with some fields. I would like to make it visible new field based on another drown down value selection.

Appreciate your kind response.

Regards,

Janto

5 answers

Hi,

You cannot make the field visible invisible based on other field selection by default.

You can make the field mandatory based on the field value selected though. This you can achieve by doing some java script in the description field of the target field.

Another possiblility is to write a validator using the script runner plugin that checks the source field for value and then makes sure target field is filled.

Vijay

Thanks for your prompt response. I have tried adding the below script on my second field(the one I want to make visible based on first dropdown selection) description.

First custom field ID - customFieldId=10000

Second custom field ID - customFieldId=10004

Is that the right way to add the script? Could you someone guide me how to add script on custom fields?

<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
callChangeFunction();
});
callChangeFunction();
function callChangeFunction(){
showHidField();
// dropdown custom field change function
$("#customFieldId=10004").change(function() {
showHidField();
});

}
function showHidField(){
//drop down field selected value
var dropDownFieldval = $.trim($("#customFieldId=10000 :selected").text());
//test field1
$("#customFieldId=10004").closest('div.field-group').hide();
//test field2
$("#customFieldId=10004").closest('div.field-group').hide();
if(dropDownFieldval == 'video'){
$("#customFieldId=10004").closest('div.field-group').show();
}
}
});

</script>

Cheers,

Janto

Hey,

I tried with the suggested options. Unfortunately it is not working. I'm using JIRA 6.2.7 verion. Will it be a problem? Is there any work around for version specified?

janto

Hi Friends,

My requirements will explain in detail.

On create issue screen, I want to hide the custom dropdown in the form dynamically (I would like to make it visible new field based on another drown down value selection). Hence I tried some JavaScript on the target custom field description portion as you mentioned above. Unfortunately the JavaScript is not working at all. Could you please let me know what was the reason? Also help me to guide on the right direction to achieve the same.

Will it possible through JIRA script runner / groovy runner to achieve with build-in script.

Regards,

Janto

If I understand what you are looking for, we use InTenso Dynamic Forms for this. If that's the same as the plugin that was mentioned above, it's worth every penny.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

187 views 0 4
Read article

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