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

How to refer to report's check box groups from the javascript code?

Started by eq85, 10 Jun 2009 03:01:08 PM

Previous topic - Next topic

eq85

I got stuck with the simple (I guess) modification to a Cognos report, and will be very grateful for your help.

There are two value prompts created by Report Studio (both "Check Box group"), say, with the names CBG1 and CBG2.
When a user selects values in CBG1, the corresponding options in CBG2 are not refreshed until Reprompt button is pressed.
I need to eliminate this step, and make CBG2 update its values "on-the-fly", upon changing the selected values of the first check box group.

I know how to make this work for a regular javascript, using onchange events, looping through option(i) properties, etc.
I cannot apply this approach to the report page as I failed to realize so far how to refer to two check box groups on the screen? To be able to change their OnChange properties and write a custom function for processing changes in selected items of CBG1?

Or, maybe there are some "standard" solutions/approaches to this task?

Thank you.

UPDATE: I tried the approach suggested in some post here: checked document.forms["formWarpRequest"].elements["_oLstChoicesCBG1"].options[ i ].selected and such upon a button press, but got the following javascript error: 'document.forms.formWarpRequest.elements' is null or not an object

eq85

No replies yet...
OK, I investigated a little bit further and found that references through _oLstChoicesXXX naming convention don't work as they should, according to Upgrading JavaScript Applications to IBM Cognos 8.3/8.4 document.

The documents states that
All other prompt objects need to be accessed using another technique, such
as using a named span tag (<span>) around the prompt object and
accessing the span tag via the getElementById() function and the prompt
object items using the getElementsByTagName() function.


I am trying this approach now for Check box groups as well.

Can anyone help with understanding the following lines from the example in 1017271 - Javascript: How to use stored procedure with input parameter that takes in multiple values:

// get the handle for the 1st checkbox prompt - add div around them to distinguish
var prompt1 = document.getElementById('checkboxPrompt1');


How am I supposed to "add div around"?

Thank you