Show/Hide Checkbox Field based on Component

Marc Jason Mutuc
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.
May 18, 2017

This is the code I'm using but it does not seem to work

<script type="text/javascript">
component = document.getElementById('component');
if (component) {
target = document.getElementById('customfield_13300');
// Hide the target field if component isn't (02) Build
if (component.value != '(02) Build') target.style.display='none';

component.onchange=function() {
if (this.value == '(02) Build') {
target.style.display = '';
// target.value="enter message here";
} else {
target.style.display='none';
}
}
}
</script>

Basically, if the component is not (02) Build, my Checkbox field should not be shown. Upon trying the above field, it is still showing on all cases.

customfield_13300 is a checkbox field.

1 answer

0 votes
Thanos Batagiannis _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.
June 12, 2017

Hi Marc,

May I ask if you have Script Runner for JIRA server installed (I am asking because one of the tags you used is the ScriptRunner key) ?

If that is the case that did you try to use a ScriptRunner Behaviour ?

regards, Thanos

Suggest an answer

Log in or Sign up to answer