If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Java Script to show and hide report object on Prompt page

Started by Cognos10x, 09 Aug 2016 03:15:51 PM

Previous topic - Next topic

Cognos10x

 I need to show and hide the optional prompts on the prompt page. Can please help with the Java script.
I found a Java Script which can do that but couldn't figure out how to hide the report object/prompt by default on the page load. I have attached the .xml page for your reference.

AnalyticsWithJay

I didn't load your report specs, but to hide it on load you can do the following:

Place an HTML item to the left of it with the code:
<div id="myFirstPrompt" style="display: none; visibility: hidden;">

... Your Prompt Here ... After the prompt, place the following code in an HTML item:

</div>

Your JS code will reference the ID of an element to make it visible. Make sure you change the ID of "myFirstPrompt" to whatever you want. Also note that IDs must be unique, so if you have more than one prompt you want hidden, choose different names.

Obligatory disclaimer: JS code can break reports during future upgrades. Use it with caution.

dougp

I'd love to help, but I couldn't load your report spec.

What version of Cognos are you using?
Is the sample code using the Samples that came with Cognos?  (Great Outdoors)
Can you please describe your requirements?  (What is the expected user behavior or condition that hides or shows optional prompts?)

You shouldn't need to use JavaScript to do this.  It can be done with parameters and conditional rendering.  That should survive an upgrade.