Hi Gurus,
We have a requirement, where we need to display the values of value prompt as a tool tip, when we do a mouse hover on the values of value prompt list box. We are using Cognos 10.2.2 and model is relational.
When I googled, I found the below script, but it always displays a static tool tip "My value prompt tool tip message.", but I wanted to display value of list box value prompt as a tool tip when I do mouse hover instead of static text.
<div id="VP_myPrompt">
</div>
<script type="text/javascript">
var oContainer = document.getElementById("VP_myPrompt");
var oPrompt= oContainer.getElementsByTagName("select");
oPrompt[0].title = "My value prompt tool tip message.";
</script>
Can some one, please let me know if you guys have any suggestions/inputs.
Thanks & Regards,
XYZ
Thanks All,
I got the solution below is the java script code I have used to get the tool tip pop of values on mouse over on value prompt.
Follow the below steps:
1) Use a div tag to give a name to value prompt as below and place to the left of the value prompt.
<div id="my_list">
2) Close the div tag as shown below, place the this tag on the right of the value prompt.
</div>
3) Place the third HTML item after the closed div tag and paste the below script.
<script>
{
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.title = arr_items.value;
}
}
}
};
</script>
It works fine with Congos 10.2.2.
Thanks & Regards,
XYZ
Hi Gurus,
I have a question here, the below java script work fine, but the java script displays the use value of a value prompt. But my requirement is to display display value of a value prompt.
Can you guys please let me know, how to get the display value as the tool tip value on mouse hover instead of use value!
Thanks & Regards,
XYZ
Change: arr_items.title = arr_items.value;
To: arr_items.title = arr_items.text;
Thank you very much bdbits.
Suggestion has worked. This is what I wanted.
small correction in my code, we need to arr_items.title = arr_items.text; instead of arr_items.title = arr_items.text;.
Your help is much appreciated.
Thanks & Regards,
XYZ