Hi,
To display the first options or whatever options:
I am using value prompt with multiple selections and type of checkbox.
I tried by using the below code(javascript):
alert(getFormWarpRequet()._oLstChoicesmchck[0].checked=true);
Note:
mchck-->name of the checkbox prompt
The same logic with 'Selectd' is working for list type. Unfortunately i am not getting result in checkbox.
Please provide the solutions as it would be needed.
Thanks,
Yogeswari.
Try the following instead:
<script language="javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}
fW._oLstChoicesmchck.options[3].selected=true;
alert(fW._oLstChoicesmchck.options[3].value);
alert(fW._oLstChoicesmchck.options[3].dv);
</script>
"value" returns the use, "dv" returns the display value. You can get the total number of elements in the prompt using fW._oLstChoicesmchck.options.length. If you want to remove certain elements, use fW._oLstChoicesmchck.remove(1). And if you use that method to get rid of the line, remember to do: list.removeAttribute("hasLabel");
First of all, thanks for your reply. :
I have tried your code, but getting error.
I am using Cognos 10.1 and attaching screen shot for your guidance.
Please provide solutions, as i am searching for long days but no solutions. :( :( :( :(
Ah, now I remember. Checkboxes are annoying.
The code I gave was for drop down prompts, it won't work with Checkboxes. Fixing that to
<script language="javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}
fW._oLstChoicesmchck[3].checked=true;
alert(fW._oLstChoicesmchck[3].value);
alert(fW._oLstChoicesmchck[3].dv);
</script>
Will select the correct value, but the checkbox won't appear checked. If you click on reprompt the page will refresh and show it to you correctly. Instead of doing .checked=true, we can do the cheating way of:
fW._oLstChoicesmchck[3].click();
That will simulate someone actually clicking on the checkbox.
Hi,
Thank you so much. :)
But now i need to know how to uncheck the checked items in check box prompt.
Why i am asking this because the scenario is like that.
If user clicks any other item in checkbox then by clicking finish the first value in checkbox should be clicked.
so i need to uncheck the values selected and check the first value.
how to uncheck the values in checkbox prompt?
Please help me. I will consider your help as a great since i am searching for long days.
You're requirement is actually confusing me a bit. Why should the report override the user selections and force the first value to be selected? Once I understand your needs, then I can give a more complete answer.
Thank you.
No actually to enhance my knowledge i have asked this. I tried this scenario with all other prompts with single and mutiple selection. All are working fine.
But i got struck with checkbox only. Do you have solution to uncheck the tick mark for checkbox? and how to determine whether the particular checkbox is ticked or not?
Thanks in advance.
Take the following JS
if(fW._oLstChoicesmchck[3].checked) fW._oLstChoicesmchck[3].click()
That will test if the fourth checkbox is checked, and if it is it will click it. You can reverse it with:
if(!fW._oLstChoicesmchck[3].checked) fW._oLstChoicesmchck[3].click()
If it is not checked, then it will check it.
You can loop through the checkboxes:
for(i=0;i<fW._oLstChoicesmchck.length;i++){
if(fW._oLstChoicesmchck[i]) fW._oLstChoicesmchck[i].click()
}
That will loop through each checkbox in the group click on every box that is checked (essentially ensuring every checkbox is unchecked).
Hi Paul,
It is working...You have given me solution for longer search....Million times thank you :) :) :) :) :) :) :)..
Thank you so much.
You are really GREAT!!!!!!
Thanks,
Yogeswari.