Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Teja
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.
April 10, 2017

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
Nic Brough -Adaptavist-
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.
April 10, 2017

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.

Teja
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.
April 11, 2017

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