I'm a little confused about using the Prompt API to show or hide a prompt.
This will ultimately depend on a hidden list of prompt name that will be set on the prompt page. Depending on whether or not a value is in that list, I want the ability to show or hide a prompt. This will allow me to have a dynamic prompt page that shows or hides a prompt depending on values I pass to it.
I know that using display='none' will allow me to hide a control without it taking up space on a page. There are plenty of Javascript examples showing how to do this using something like:
function HideIt(){
var hideit = document.getElementById("promptid");
hideit.style.display = 'none';
}
I also know that display is one of the values that can be used as a parameter in the Prompt API. Can this be used to hide a prompt, as in?
var oCR= cognos.Report.getReport('_THIS_');
var myprompt = oCR.prompt.getControlByName('myprompname');
var displaynone = [{'display': 'none'}];
myprompt.setValues(displaynone);
I tried using this and it didn't work. I could be doing something wrong or, I suspect, the display can only be used to display some text in a text box or something like that.
Because the Prompt API is relatively new, and because there are a lot of older Javascript examples out there, I'm still not sure what can be done with the Prompt API and what needs to be done the older Javascript way.
Also, how can I use prompt.getControlByName along with a list of control names to see if toggle show/hide depending on whether the controll name is in the list? Any suggestions?
hi,
try setting the Box Type property of the prompt to "none"
Regards