COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: darners on 03 Sep 2015 08:22:01 AM

Title: Prompt API (onload event)
Post by: darners on 03 Sep 2015 08:22:01 AM
HI, I am trying to get a prompt api to run when the prompt page is loaded

<script>
function clearValues() {
var oCR = cognos.Report.getReport("_THIS_");
var promptFini = oCR.prompt.getControlByName("fini");
        var selection1 = [{'use': 'Y'}];
        promptFini.setValues(selection1);
}
</script>

This works fine if I make it a button or a link but I need it to run whenever the prompt page loads

I have tried placing the html in various places on the prompt page but without success

Any ideas?

Cheers
Title: Re: Prompt API (onload event)
Post by: darners on 07 Sep 2015 04:22:26 AM
any ideas gratefully received :)



Quote from: darners on 03 Sep 2015 08:22:01 AM
HI, I am trying to get a prompt api to run when the prompt page is loaded

<script>
function clearValues() {
var oCR = cognos.Report.getReport("_THIS_");
var promptFini = oCR.prompt.getControlByName("fini");
        var selection1 = [{'use': 'Y'}];
        promptFini.setValues(selection1);
}
</script>

This works fine if I make it a button or a link but I need it to run whenever the prompt page loads

I have tried placing the html in various places on the prompt page but without success

Any ideas?

Cheers
Title: Re: Prompt API (onload event)
Post by: mrcool on 07 Sep 2015 07:40:18 AM
I am not good in JS or HTML but I think you shoud use onload event inorder to execute the script while loading the page.