How do I hide custom fileds based other custom field on create screen only?

Hi,

I have a checkbox custom field named 'Fruits' and value Requested.

And other 3 more custom fields.

When user clicks Requested it should shows other 3 custom fields else not.

Prior to that all 3 custom fields must be hidden.

 

1 answer

0 votes

You will need some code to do that.  Either a custom field type that can support it, or injected javascript. 

The Behaviours module in the script runner add-on can do this too, it does the javascript for you.

Yes Nic,

I am using this below code using JavaScript through the plugin

function fruitnewField(){

$('#customfield_14201-1').click(function() {   // Fruit cf


if (document.getElementById('customfield_14201-1').checked){ AJS.$("#customfield_14202").closest('div.field-group').show();  //other cf
AJS.$(":input[name='customfield_14203']").closest('fieldset.group').show();  //other cf
AJS.$("#customfield_14204").closest('div.field-group').show();  //other cf

}
else{
AJS.$("#customfield_14202").closest('div.field-group').hide();

AJS.$(":input[name='customfield_14203']").closest('fieldset.group').hide();
AJS.$("#customfield_14204").closest('div.field-group').hide();
}
});

When I checked check box other cf are shows and when I unchecked it cf are hides.

But the problem is how to hide these other custom fields on the load of create screen when the check box is unchecked defaultly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,711 views 17 21
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