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

is it possible hide/unhide a block by java script?

Started by everlearner, 20 Jun 2014 06:17:43 AM

Previous topic - Next topic

everlearner

Hi Gurus,

i have a block with some content on my prompt page,
the requirement is the block should be hide by default, when user click a hyperlink then it has to display. again when clicked hyperlink has to hide.

is it possible by java script,
any one have idea about this???

thanks in adv



Raghuvir

not the right person to comment on javascript, but can u try to achieve your requirement by using conditional block ?

Regards

BigChris

as Raghuvir says, you should be able to do this with a conditional block / render variable based on an auto submitting prompt.

MDXpressor

Quote from: BigChris on 20 Jun 2014 07:49:15 AM
as Raghuvir says, you should be able to do this with a conditional block / render variable based on an auto submitting prompt.

Yes a conditional block will work.  This is a server-side action however, and that will cause the report to reload the data.  For a quick report this is not an issue, for a report that takes 5 minutes to load, it might be...

Quote from: Raghuvir on 20 Jun 2014 07:00:25 AM
not the right person to comment on javascript, but can u try to achieve your requirement by using conditional block ?

Regards

Further proof that .js itself is not the risk. But the pool of resources who know Cognos is small.  The pool of resources who know Cognos AND .js is very very small.  Make sure you know what you're committing your company to when you introduce .js.  If you don't know how to hide a simple <div>, then my concern is that you are over your head where .js is concerned.  So, if you're simply trying to learn and expand your horizons, I applaud you.  If you are trying to add bling to your report, I'd suggest sticking with traditional Cognos solutions (conditional blocks).

... my 2 cents.
No, a proof is a proof. What kind of a proof? It's a proof. A proof is a proof, and when you have a good proof, it's because it's proven.

-Jean Chretien

everlearner

i done it by conditional block, also simply trying to learn the same by java script.
thanks all for ur replies.

rprameshwor

yes, it is possible to get done through javascript.

enclose your block with a div tag , lets say 'prompt'
Put a button outside the div which on clicking calls a function, lets say toggle
A rough JS logic given below :

button : <input type='button' onClick='toggle()' value='show-hide prompts'>

<script>
function toggle{
if(document.getElementById('prompt').style.display=='none')
document.getElementById('prompt').style.display='block';
else
document.getElementById('prompt').style.display='none';
}
</script>