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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Javascript Issue in 8.3

Started by The_Burg, 24 Jun 2008 04:55:28 PM

Previous topic - Next topic

The_Burg

Good afternoon.
I have a prompt setup and working in 8.2 that is a radio button.  One selection will display a prompt below it and will hide on any of the other selections.  When using it in 8.3 it doesn't work at all.  Below is the code at the top of the table, followed by the code that is surrounding the Prompts.  If anyone has an idea on how to make this work that would be great; thanks.

<script type="text/javascript">
function setDates(){
  var cyr = document.forms['formWarpRequest'].elements['_oLstChoicesCYR'];
  document.getElementById("DATES").style.display="none";
  if(cyr[0].checked) {
    document.getElementById("DATES").style.display="";
  }
}

</script>

Code at the start and end of the radio prompt<div onclick="setDates();">
</div><div id="DATES" style="display: none;">

Code at the end of the prompt that will be shown with a certian selection in the first prompt<script type="text/javascript">
setDates();
</script>

rockytopmark

Prompt objects object names change as the report is executed.  Cognos may be fixing this, but no guarantee.

Cognos also clearly states that such scripting is not supported and may not work with newer version of the product.

bonniehsueh

Agreed. I also have run into the same issue and found that Cognos does not support Javascript. Depending on what you are trying to do, conditional blocks may address what you are looking for.

dipstm

Hi,
I also had some reports in which I used Javascripts for customizations of report and it was workin fine in Cognos 8.2. Later we migrated to Cognos 8.3 and then Javascripts didn't work.Also raised case with Cognos for this but Cognos support people say that Javascripts are not supported in the product.
I m also waiting when this issue of prompt names getting changed will be resolved.
If anyone has any update on this pls share it.

Regards,
dipstm

k2

Hope this will help you.

[ Some scripts that are explained in the KBs to change the first line title of a value prompt, and to set default selection in value prompt do not work in 8.3. ]

Error Message:

[ n/a ]

Environment:

[ C8.3 Report Studio ]

Root Cause:

[ All the prompt objects in 8.3 are now dynamically named. This is why methods such as:

document.formWarpRequest._oLstChoicesprompt1[0].text = 'Select a Order
Method...';

document.formWarpRequest._oLstChoicesprompt1.options[0].selected =
true;

may not work because of its way in referencing the objects. There is a layer that added a backward compatibility with older scripts, but it does not work properly sometimes. The solution below is a temporary workaround to reference the objects.

]

Solution:

[ Surround the value prompt with HTML items in Report Studio, then add a third HTML item at the bottom of the prompt page with new script ]

Steps:

[ 1. Add an HTML item to the left and right of the value prompt in the Report Studio

2. For the first HTML item (left) add '<span id = "A1">'

3. For the second HTML item (right) add '</span>'

4. Add an HTML item at the bottom of the prompt page next to "Run" button

5. Add the following script for the third HTML item:

<script type="text/javascript">

                var theSpan = document.getElementById("A1");
                var theSelect = theSpan.getElementsByTagName("select");
                theSelect[0].options[2].selected=true; //This will make default value in prompt to be the first item after line, change the value '2' for other item
                theSelect[0].options[0].text = '<PUT WHATEVER TEXT FOR VALUE PROMPT TITLE HERE>';

                canSubmitPrompt();

</script>

6. The value "A1" can be anything you like. Run the Report.

]

Related documents:

[ 1013968.3 ]

Sunchaser

Hi all,

What I'm going to say won't solve any issue, sorry, but ....

As soon as I see some topics about Javascript / Cognos problem, I can't hide that it's getting me in a very bad mood.
In my opinion, Cognos's answer about this problem is not acceptable, not professional.

We are not talking about a freeware or a shareware, or any student's open source project !
Did they forgot about the prices of their licence ?
This is not a game, this is a strong business and we need full functionality to keep on working correctly.

Wake up Cognos, wake up...please.

bie,
vinc

rockytopmark


kadhir

Hi All,

I am not sure whether I am addressing your problem correctly. But I do have come across 'Javascript' issue while developing some reports. It may be an idea to see external things that cause Javascript problem, instead looking into Cognos itself. I mean, it may be a problem of IIS web server, Internet explorer, etc.. Please refer to my other postings in this site.
http://www.cognoise.com/community/index.php?topic=4969.0

Also, My findings tell me to do following things :

Do the un-registering and registering of the DLLs as shown following:

http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3760879&SiteID=17

Hope that helps..
Good luck,
Kadhir

asirilow

As far a javascript goes, we have had the same issues with the objects (i.e. check boxes, radio buttons, drop downs....).  You can resolve it a couple of different ways. 

for example:  On prompts we like to give the users the option of selecting a fiscal year or using a custom date range.  We use radio buttons to do this as well as an on click event to hide or show fiscal years or date prompts.  Before 8.3 we used a radio button prompt, named it and then called it with the onclick event within the javascript.  in 8.3, to combat this problem we had to create forms/input items to still maintain the onclick integrity.  It made our code lengthy but it gets the job done. 


the other way we have solved this issue is to surround the item with HTML tags and then call the javascript show/hide functions with an on move event.  It works ok but I think it is a sloppy work around and makes us look like nubs.