COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: pcog on 12 Dec 2013 04:14:55 PM

Title: Cognos 8.4.1 Select & Search prompt default option Javascript
Post by: pcog on 12 Dec 2013 04:14:55 PM
I have requirement to change the default selection of Cognos Select & Search prompt. By default Cognos will select the 'Start with any of these keywords', but user requested to have default option of 'Contains any of these keywords'. They also want to remove the other options, but I can negotiate with that if I get the default option per requirement.
I found KB technote 1372246 and 1341747, but those are not working, may be because those are not for 8.4.1.

Does anyone had this req before or can anyone help me out here?
Title: Re: Cognos 8.4.1 Select & Search prompt default option Javascript
Post by: pcog on 16 Dec 2013 03:18:41 PM
Does anyone know the script for this?
Please reply me.
Title: Re: Cognos 8.4.1 Select & Search prompt default option Javascript
Post by: CognosPaul on 17 Dec 2013 12:57:16 AM
Put an HTML item before the prompt with: <div id="mySnS">

Put another HTML item after the prompt with </div><script>document.getElementById('mySnS').getElementsByTagName('input')[4].click();</script>
That should select "Contains any" in all versions of Cognos.

I don't have a copy of 8.4.1, so I don't know the DOM structure of the prompts. Use IE Dev Toolbar to examine the prompt. Then you can figure out which element to hide.
Something like:
<script>document.getElementById('mySnS').getElementsByTagName('div')[5].style.display='none';</script>
Title: Re: Cognos 8.4.1 Select & Search prompt default option Javascript
Post by: pcog on 17 Dec 2013 09:48:54 AM
Thanks a lot Paul, it is working now.
But, the second response in your post regarding hiding any of those options? If yes, where should I include that script? in a separate HTML item or the second one?
sorry I'm not expert in using java scripts :(