Hi,
We have a JavaScript to select a defaultValue in a check box prompt in prompt page.
The weird thing is, the value is selected. However the check box doesn't display the tick mark.
If I click on Finish button, the report page shows that the value is selected indeed.
Here is the JS I used for selecting the first prompt value by default.
<script>
var theSpan = document.getElementById("myCheckBox");
var myInput = theSpan.getElementsByTagName("input");
myInput[0].checked="1";
myInput[0].ariaChecked=true;
myInput[0].parentNode.className = "dijitInline dijitCheckBox";
</script>
I'm going crazy trying all ways to select the value; everything turns success to select the value, but doesn't show the tick mark though... Any solutions?
PS: The code works like a gem in Cognos 8.4; it fails to show the tick mark only in Cognos 10.1.1
Any inputs on this ?? Guess it seems to be some herculean issue..
we did not use java but this is how we set up our checkboxes
1. Open report in Report Studio then unlock report.
2. Drag 2 images into the field where you want to place the checkboxes.
3. Open up your variables and create a new Variable as a string.
4. Add 2 new Values, one a Y and the other a N.
5. Rename the Variable to something meaningful.
6. Go back to the report page and highlight the first image in your field.
7. In the properties go to the Render Variable hit the elipses and find the Variable, uncheck the N box.
8. Add ..\pat\hal\images\lv_checkbox_checked.gif to the URL under URL Source.
9. Go back to the report page and highlight the second image in your field.
10. In the properties go to the Render Variable hit the elipses and find the Variable, uncheck the Y box.
11. Add ..\pat\hal\images\lv_checkbox.gif to the URL under URL Source.
12. Highlight the field name, make it invisible and center the boxes.
Thanks for the reply. However, I should confess that in my case the number of items in the check box prompt is dynamic, and the value that needs to be selected by default may not always be the first item. In this case showing/hiding images of tick mark may not work out...
Hi Paddhu,
Use the following script.
<script>
var theSpan = document.getElementById("myCheckBox");
var myInput = theSpan.getElementsByTagName("input");
myInput[1].checked="1";
myInput[0].ariaChecked=true;
myInput[0].parentNode.className = "dijitInline dijitCheckBox";
</script>
I have change the index to 1. Since the first checkbox is hidden and not shown to users.
Regards,
Rahul
Doesn't seem to work either.. For now we have coded with a workaround Default Selection in the prompt using some calculated data items, but it doesn't give the full functionality expected. Would still like to know any inputs on this.
Hi can you please provide me solution that you have done I am also facing the same problem.
I am facing same issue..Anyone have solution for this