I did this on 11.2.4 version.
1- Toggle OFF the "Run with full interactivity" in Report page.
2- Add below javascript in an HTML block in Prompt Page.
<script type="text/javascript">
// <![CDATA[
setTimeout(function() {
var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].name && inputs[i].name.indexOf("chkAnyValue") !== -1) {
if (inputs[i].checked) {
inputs[i].click();
}
}
}
}, 500); // Small delay to ensure the prompt finishes rendering
// ]]>
</script>
------------------------------
Toygunavinil M
------------------------------
Original Message:
Sent: Wed March 27, 2019 09:06 AM
From: Janice Rosche
Subject: Cognos 11.0.8 Uncheck default on optional date prompt
In Cognos 11.0.8 I am trying to uncheck the default for the optional date prompt for users. In the past JS worked, however when trying to use the scripts found online they fail on (var i = 0; i < node_list.length; i++). Is it the code or is it that 11.0.8 does not support JS any longer? Is there another work around?
Insert an HTML item into the prompt page and place it on the right of the prompt. Double click on this item and insert the following Javascript code:
<SCRIPT TYPE="text/javascript">
function init()
{
// need to find all the checkboxes on the page for the date prompt
// and set to false
var node_list = document.getElementsByTagName('input');
for (var i = 0; i < node_list.length; i++)
{
var node = node_list[i];
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);
}
}
}
}
}
init();
</SCRIPT>
Click OK. When running the report the Check box will be disabled by default.
------------------------------
Janice Rosche
------------------------------