COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Dulanic on 20 Feb 2014 12:59:22 PM

Title: Prompt not working after changing selections /w Javascript
Post by: Dulanic on 20 Feb 2014 12:59:22 PM
I have a prompt page /w a checkbox group. I used the code from:

http://www.cognoise.com/index.php?topic=17818.0

I added this to the page:

<script language="javascript">
function clickDeselectAll()
{
   var checkbox = window.event.srcElement.parentNode.parentNode.parentNode.parentNode.parentNode;
   checkbox.getElementsByTagName("a")[1].click();
   window.event.srcElement.ariaChecked=true;
   window.event.srcElement.checked=true;
   window.event.srcElement.parentNode.className += " " + 'dijitCheckBoxChecked';
}

function uncheckAll()
{
   var checkbox = window.event.srcElement.parentNode.parentNode.parentNode.parentNode.parentNode;
   checkbox.getElementsByTagName('input')[0].checked="";
   checkbox.getElementsByTagName('input')[0].ariaChecked="false";
   checkbox.getElementsByTagName('input')[0].parentNode.className = "dijitInline dijitCheckBox";
}
</script>


Along /w this:

<script>
var checkboxes = document.getElementById('Prompt1').getElementsByTagName('input');
checkboxes[1].attachEvent('onclick',clickDeselectAll);

var i = 0;
for (i=2;i<checkboxes.length;i++)
{
checkboxes[i].attachEvent('onclick',uncheckAll);
}
</script>


It works great... except for when they click the top option "None"... it deselects all except the top option "None" but then the prompt button is grayed out.. like it isn't registering that None is selected?