COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: hrk551 on 17 Mar 2009 10:37:54 AM

Title: ToolTip For a value Prompt ????????????
Post by: hrk551 on 17 Mar 2009 10:37:54 AM
How can we make a tooltip for a value prompt. Ex: In my drop down list I have region a,Region B, Region C  .... Each region represents a set of countires...... When the user moves his cursor on to prompt a toooltip has to be displayed Showing wat all the regions consist of from then user can select his region.
I am using 8.3,and I am not using any prompt page.


Thanx
Title: Re: ToolTip For a value Prompt ????????????
Post by: Sunchaser on 21 Mar 2009 06:23:39 AM
Hi,

Before I post anything, I should mention that using javascript (because in that case, I don't see any other solution, but I might be wrong) in cognos8.3 is not recommanded and could give some problems (I used to have a lot ...)

So, now, here is a possible solution:

You may need 4 html items (small code inside, don't worry).

1) Put the first one at the beginning of your page:

first html item:


<head>
<script>
function doHints()
{
alert("I can see you");
var get_myList = document.getElementById("my_list");
if (get_myList != null)
{
var target_list = get_myList.getElementsByTagName("SELECT")[0];
if (target_list != null)
{
var arr_items = target_list.getElementsByTagName("OPTION");
for ( var i = 0; i < arr_items.length; i ++ )
{
arr_items[i].title = "this is my info hint for region No: " + (i+1);
}
}
}
};
</script>
</head>


2) Put the second one just before the value prompt (at the left of this object):

second html item:


<div id="my_list">


3) Put the third one just after the value prompt (at the right side of this object):

third html item:


</div>


4) Put the fourth one just at the end of the page:

fourth html item:


<body onload="doHints()"></body>


Run your report in HTML format, of course ...

Hope it coud help you.
vinc.
Title: Re: ToolTip For a value Prompt ????????????
Post by: Sunchaser on 21 Mar 2009 06:50:12 AM
Last thing I forgot to say:
a good tool for working with JS in Cognos pages is IE Developper ToolBar.

It's a little bit like Firebug in FF, and it's really usefull to see and understand Cognos object's hierarchy in HTML pages.
Title: Re: ToolTip For a value Prompt ????????????
Post by: hrk551 on 24 Mar 2009 03:15:14 PM
Thanx for replying SUNCHASER .....  above code just displays a alert messg when I click on run button. I dont want to display an alert message box .. I want a tooltip...

Thank you
Title: Re: ToolTip For a value Prompt ????????????
Post by: Sunchaser on 24 Mar 2009 04:33:29 PM
Hi; You can delete the line:

alert("I can see you");

but the line:

arr_items[i].title = "this is my info hint for region No: " + (i+1);

will give you an information while the mouse is over an item in the value-prompt.
I've tested on my computer, was working.
Title: Re: ToolTip For a value Prompt ????????????
Post by: hrk551 on 29 Mar 2009 08:42:28 PM
Sunchaser,

Thank you , its working, But a small change ... this is giving a tooltip on the values, can we get tooltip on the tool i.e on the value prompt itsself not on  the list values

Thank you