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

 

Javascript Not working in Cognos viewer(Portlet), But Working in Report studio

Started by kenrisen, 01 Jul 2011 10:12:26 AM

Previous topic - Next topic

kenrisen

Hi all cognos gurus,
Here is my issue....
I am trying to set first data as a default values for my prompt. I used JavaScript for that which worked perfectly fine, when I run report through report studio. But when I tried to run that report through Cognos Viewer Portlet, it seems, JavaScript is not working.
Cognos version 10.1
JavaScript I am using..

<script type="text/javascript">
function init()
{
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if (fW)
fW._oLstChoicesUser.options[2].selected = true;
canSubmitPrompt();
}
init();
</script>

"User" is my value prompt name
how to solve this?
btw i'm a javascript newbie.

kenrisen

i solve this problem..
for everyone, you can use this script

<script language="javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}
fW._oLstChoicesUser.options[2].selected = true;
var preFix = "";
if (fW.elements["cv.id"])
{
   preFix = fW.elements["cv.id"].value;
}
</script>