COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Upgrading to Cognos 10 => Topic started by: simi on 01 Jan 2013 09:31:16 PM

Title: Java Script Issues when Upgrade Cognos 8.2 to10.2
Post by: simi on 01 Jan 2013 09:31:16 PM
Hi All,

We are upgrading the reports from Cognos 8.2 to Cognos 10.2. we are facing most of the issues related to java script in the prompt pages. Can you please help out to find the solution to find the following code which is not working in 10.2?

<script language='JavaScript'>

function checkBoxCaseID.selectAll()

{
alert("message");
}

</script>
Title: Re: Java Script Issues when Upgrade Cognos 8.2 to10.2
Post by: abhishek.sanghani on 26 Mar 2013 10:11:53 AM
With IBM Cognos 8.3, the report viewer architecture has been majorly changed. Before IBM Cognos 8.3, it was a common practice to define a NAME or ID for the prompt controls and use that to manipulate controls at runtime through JavaScript.
However, version 8.3 onwards, the IDs of the controls are generated randomly and are not fixed. So, it is a little difficult to get hold of a control. For this reason, we have defined a SPAN around the control that we want to manipulate.
By wrapping the control within SPAN tags, we will reduce the scope of our search in JavaScript.
Title: Re: Java Script Issues when Upgrade Cognos 8.2 to10.2
Post by: bdbits on 27 Mar 2013 03:35:33 PM
For 8.3 and later you need code like the following:

var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
  if (!fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ ); }
  return fW;

Then you can reference controls like this:
  fW._oLstChoicespromptNameOfMyPromptControl

But since you are now on 10.2 and are going to have to update your javascript anyway, you may as well check out the new prompt API.

http://pic.dhe.ibm.com/infocenter/cbi/v10r2m0/topic/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.0.doc/c_prmpt_api_overview.html (http://pic.dhe.ibm.com/infocenter/cbi/v10r2m0/topic/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.0.doc/c_prmpt_api_overview.html)