I obtained the below javascript from a website a while back which shows and hides a date prompt based on the selections from a radio button value prompt.
<script type="text/javascript">
var inputs = document.getElementsByTagName("input");
var list_box = new Array();
/****Identify Radio Buttons and load them into an array****/
var radio_buttons = new Array();
j=0;
for(i=0;i<inputs.length;i++)
{
if(inputs[i].type=='radio')
{
radio_buttons[j] = inputs[i];
j++;
}
}
/****Set the onclick event of each radio button option to trigger our custom function****/
radio_buttons[0].setAttribute("onclick",function(){ToggleDate();});
radio_buttons[1].setAttribute("onclick",function(){ToggleDate();});
radio_buttons[2].setAttribute("onclick",function(){ToggleDate();});
/****Create a handle for date prompt****/
var prompt = document.getElementById("date_prompts").childNodes[0];
function ToggleDate()
{
if(radio_buttons[0].checked)
{
/**** First options (in our case "Custom") is selected.****
**** Date Prompt will be Shown or Enabled. ****/
document.getElementById("date_prompts").style.display = ''; //show
// prompt.disabled = ''; //enable
canSubmitPrompt();
}
else
{
/**** Second options (in our case "Yesterday") is selected.****
**** Date Prompt will be Hidden or Disabled. ****/
document.getElementById("date_prompts").style.display = 'none'; //hide
//prompt.disabled = 'true'; //disable
canSubmitPrompt();
}
}
</script>
Whilst we have been using Cognos 10.2.2 this code worked fine (in conjunction with a couple of other html items spanning the date prompt). We're now in the process of upgrading to Cognos 11.0.11, whilst I've been testing the reports in the new environment I've found that this code no longer works and the date prompt is shown irrespective of what choices are selected with the radio buttons.
Please can someone give me some pointers as to what might be going on here or better yet tell me how to resolve the issue.
When creating a new report in Cognos 11 and adding the elements individually the following error message occurs...
HTML report output is not well formed. If your report uses "HTML Item" elements ensure that they result in well-formed HTML.
Reason: A name contained an invalid character.
URL: Line:274 Character:24 Source: for(i=0;i