Show field based on value of another

I have read the documentation supplied here and now have this working. The idea is that a certain field is shown when working for a particular client:

<script type="text/javascript">
    client = document.getElementById('customfield_10010');    
    if (client) {
        target = document.getElementById('customfield_12980');
        // Hide the target field if the client is not WRB
        if (client.value != 10120) target.style.display='none';
        
        client.onchange=function() {
            if (this.value == 10120) {
                    target.style.display = '';
                } else {
                target.style.display='none';
            } 
        }
    }
</script>

However, I would like to do the following:

  • Hide the custom field label when the input box is hidden
  • Apply this code to more than one field - currently, when I add it to another field and change the IDs etc it only applied to one field

Does anyone know if this is possible?

Also, I have this working on JIRA 6.4 - I read rumours that this was broken from 6.2 upwards but it is working for me!

Thanks

Matthew

1 answer

Any ideas anyone? Hiding the input box is not as important as applying this to multiple fields...

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,799 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