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

Show/Hide the Prompt

Started by Arumugam, 25 Jan 2017 01:11:58 AM

Previous topic - Next topic

Arumugam

Hi Team,

        Is there any way to show/hide the prompt without refreshing the page?I need to show one prompt based on the selection on other prompt meanwhile it shouldnt disturb other selection

SpareTire

You'd have to use J/S to accomplish this. I tried it and I will share my scripts with you if that helps. But ultimately I found that from a U/I perspective---users don't like things to be hidden, it confuses them/suprises them. I ended up creating a second prompt page instead. I mean, how many of us really like surprises at work? Exactly.

1.Create a table with the prompt you want hidden.
2. Wrap an html tag around it as such, so it stays hidden initally and I named it "Size Prompt": <div id="size_prompt" style="display:none;" >
3.Close the html tag: </div>
4.Add another html tage in there that reads as follows:

<script type="text/javascript">
var inputs = document.getElementsByTagName("input");
var list_box = new Array();

/****Identify Radio Buttons and load them into an array****/
var radio_buttons = new Array();
j=0;

for(i=0;i<inputs.length;i++)
{
    if(inputs[i].type=='radio')
    {
        radio_buttons[j] = inputs[i];
        j++;
    }   
}

/****Set the onclick event of each radio button option to trigger our custom function****/


radio_buttons[0].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[1].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[2].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[3].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[4].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[5].setAttribute("onclick",function(){ToggleShow();});
radio_buttons[6].setAttribute("onclick",function(){ToggleHide();});
radio_buttons[7].setAttribute("onclick",function(){ToggleHide();});



/****Create a handle to show prompt****/
var prompt = document.getElementById("size_prompt").childNodes[0];

function ToggleHide()
{
        document.getElementById("size_prompt").style.display = '';
}

/****Create a handle to hide prompt****/
var prompt = document.getElementById("size_prompt").childNodes[0];

function ToggleShow()
{
        document.getElementById("size_prompt").style.display = 'none';
}

</script>


This is for a radio button prompt where I statically tell it depending on the button clicked either hide it or show it.

Good luck.

dougp

That JavaScript won't survive the upgrade to Cognos Analytics.  If you're operation will not be using Cognos after April 2018 or if you won't be in that position (so you can pass the problem on to the next guy), you may not consider that a problem.

Showing or hiding a prompt can be accomplished by placing it in a Conditional Blocks object that references a variable that is controlled by a parameter that is tied to the source prompt control.  Setting auto-submit on the source prompt control may refresh the page, but that won't cause parameter values to be erased, so the other selections won't be disturbed.
No JavaScript required.

SpareTire

Thanks, Dougp for the input. I had not kept up with Analytics and wasn't aware of the April 2018 date until now.

You are correct, this J/S will not work in the newer version of Cognos.