COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nichollsvi on 11 Apr 2014 01:11:04 PM

Title: Javascript, calendar prompt, IE & Firefox
Post by: nichollsvi on 11 Apr 2014 01:11:04 PM
We have a Gregorian calendar in Report Studio. We have 2 browsers: IE and Firefox. You have one browser where you have to click the checkbox on the calendar to make it work, the other browser, where you don't to get the calendar to work the same way. We have the following HTML code before and after the calendar.

Any ideas on how to get consistency in this? In other words, if the user wants to select the calendar prompts, they check it. If the user doesn't want to select the calendar prompt, they leave it unchecked.

Thanks,

Vic

<SCRIPT TYPE="text/javascript">
// When doing a Run in background (Now) the function init is run twice
// This counter is used to have it only execute the code the first time it is invoked
var counter=0;
function init()
{
// need to find all the checkboxes on the page for the date prompt
// and set to false
if (counter!=1) // first time?
{
var node_list = document.getElementsByTagName('input');
for (var i = 0; i < node_list.length; i++)
{
var node = node_list;
if (node.getAttribute('type') == 'checkbox')
{
// find the dateselection checkbox chkAnyValue
var currentCheckBox = node.name;
if (currentCheckBox.indexOf("chkAnyValue")!= -1 )
{
node.checked=false;
if (node.fireEvent)
{
// IE, IE is not changing the value of the checkbox
// when calling the event.
node.fireEvent("onclick");
}
else if (node.dispatchEvent)

{
// Firefox, calling this event would change the value
// of the checkbox. You might need to set it to true
// first.
var e = document.createEvent("MouseEvents")
e.initEvent("click", true, true);
node.dispatchEvent(e);
}
}
}
}
}
counter=1; // indicates we have now run this code
}
init();
</SCRIPT>