Having trouble with hiding entire field based on output from a previous field.

Jeremy Cejka August 29, 2013

So, first I have all of 3 hour of exposure to javascript, so bare with me.

<script type="text/javascript">
jQuery(document).ready(function()
{
checkbox = document.getElementById('customfield_11540-1');
dept = document.getElementById('customfield_11534');
prog = document.getElementById('customfield_11537');
func = document.getElementById('customfield_11533');
// Hide the target field by default
dept.style.display = '';
prog.style.display = 'none';
func.style.display = 'none';

checkbox.onclick=function() {
if (checkbox.checked) {
prog.style.display = '';
func.style.display = '';
dept.style.display = 'none';
} else {
prog.style.display = 'none';
func.style.display = 'none';
dept.style.display = '';
document.getElementById('customfield_11534').value = '';
}
};

});

</script>

Ive pieced together this from previous posting on the subject.

So it does sort of work, the fields for prog and func are drop menus, and it hides the menu part, but not the field label. I read that from Jira4.2 and newer, were supposed to use .parentNode; to include the entire container, that breaks the script in my case. Kind of scratching my head getting the intended outcome.

1 answer

0 votes
Jeremy Cejka August 29, 2013

Disregard, I forgot to refresh my second page that I was using to test the create issue.

Suggest an answer

Log in or Sign up to answer