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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot