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

Janto Jose June 29, 2014

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

0 votes
kris July 14, 2014

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.

0 votes
Janto Jose July 1, 2014

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

0 votes
Paresh Gandhi
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.
June 30, 2014
0 votes
Nadir MEZIANI
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.
June 29, 2014

Hi,

Look this answer it can help you and give you more ideas.

https://answers.atlassian.com/questions/306312/custom-fields-on-create-screen

0 votes
Vijay Khacharia
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.
June 29, 2014

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

Janto Jose June 29, 2014

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

Vijay Khacharia
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.
June 29, 2014

The Javascript is to be added to the description field on the customfield.

https://confluence.atlassian.com/display/JIRA/Specifying+Field+Behavior#SpecifyingFieldBehavior-editfielddescriptionEditingafield'sdescription

This link should help.

Vijay

Janto Jose June 29, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events