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 vote

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
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 yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

42 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