COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cogknow on 20 Dec 2012 03:30:21 PM

Title: Javascript for Multiselect Checkbox Prompt
Post by: Cogknow on 20 Dec 2012 03:30:21 PM
Hi All,

We have a multi select check box prompt in my report. Prompt values are not static and they are fetched from a database column.
We need to select the first value of the prompt as default value using Javascript.

Using the below script, its picking up the first value as default value but that selection is not visible in the prompt page.

<script language="javascript">
var form = getFormWarpRequest();
var list = form._oLstChoicesChkbox1;
list[0].checked=true;
canSubmitPrompt();
</script>

Can anyone please help us with the code.
Title: Re: Javascript for Multiselect Checkbox Prompt
Post by: nachmanb on 17 Feb 2014 12:00:47 AM
see this blog:

http://cognospaul.com/2013/10/08/checking-option-checkbox-prompt/

it solves the problem
Title: Re: Javascript for Multiselect Checkbox Prompt
Post by: Deep750 on 17 Feb 2014 01:31:03 AM
Beware that scripts selecting the first value will run if you have any autosubmit/reprompting on the page, making the first value selected, even if you have selected any other value in the mean time.

My suggestion, if you have to autoselect the first value, is placing the prompt after any autosubmit/reprompting - prompts.
Title: Re: Javascript for Multiselect Checkbox Prompt
Post by: shravanmaddela on 24 Feb 2016 01:22:45 PM
Hey CogKnow,

I have the same issue:

multi select check box prompt in my report. Prompt values are not static and they are fetched from a database column.
We need to select the first value of the prompt as default value using Javascript.

Can you please help me how did you achieved this using JavaScript and if possible can you please post the javascript how you handled it.

Thanks
Shravan