COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: cmills on 03 Dec 2007 04:27:47 PM

Title: Javascript behavior in 8.3 vs 8.2
Post by: cmills on 03 Dec 2007 04:27:47 PM
We're testing Cognos 8.3 on our dev environment. We're seeing cases where some Javascript worked OK on 8.2, but blows up on 8.3. Does anyone else see this in their 8.3 test/prod environment?

One example from the knowledgebase about how to change the first item in a drop down list:
<script>
document.formWarpRequest._oLstChoicesUIDTest[0].text = 'My own text';
</script>

When we use the example it works perfectly when the page first comes up. However, when a user selects an item from the dropdown list (autosubmit), after the screen refreshes, it causes the first item in the dropdown list to revert back to the name of the query item, and a javascript error message appears:

'document.formWarpRequest._oLstChoicesUIDTest.0' is null or not an object

The prompt is on the same page as the list report - the prompt is not contained on a prompt page.

The most confusing part for my feeble brain is that the javascript behaves fine when the page first appears, it only breaks when you select an item from the dropdown list.

Thanks ahead of time for letting us know if you've experienced this, or better yet - you have a solution.


Title: Re: Javascript behavior in 8.3 vs 8.2
Post by: kattaviz on 14 Jan 2008 02:13:51 PM
Hi,

Try this option.

document.formWarpRequest._oLstChoicesUIDTest.options.selected=true;

replace the "i" with your list box index.

HTH

thanks
Satish Katta
Title: Re: Javascript behavior in 8.3 vs 8.2
Post by: bharathkv on 16 Jan 2008 04:50:37 AM
The problem with Javascript in Cognos 8.3 is that the reference variables for some prompt controls change dynamically and it would be better if a user defined control is created whenever those prompts are to be used.

For example, for text box use
<input type =text name =textbox_name  id=textbox_id>

For finish button
<button id="finishbutton_id" onclick="oCVRS.promptAction('finish')" class="clsPromptButton">

where the original finish button in prompt page of report studio should be deleted and be replaced with this code

<button id="finishbutton_id" onclick="oCVRS.promptAction('finish')" class="clsPromptButton">

Here oCVRS.promptAction('finish') would call the function which the finish button calls and therefore the new finish button would behave in the same manner as the original finish button. The class clsPromptButton would make the new finish button appear in the same way as the original finish button.