COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: TheDarkKnight on 01 Sep 2010 04:03:17 AM

Title: tool tip for a Prompt
Post by: TheDarkKnight on 01 Sep 2010 04:03:17 AM
Hello Pals,
My requirement is to show tooltip when we have a mouse over a value prompt. For eg...i have a value prompt for Status. when a user does a mouse over the prompt, it should show tooltip like 'Choose ordered status......'

i cud able to tooltip for a text using <a title> and </ a> tags in a prompt page.
but doesnot able to tooltip for the prompt itself using these tags.

Appreciate any sort of help!

If above detailsa are not clear, then pls letme know.

Cheers
TDK

Title: Re: tool tip for a Prompt
Post by: technomorph on 02 Sep 2010 06:32:25 AM
Hi,

Assuming you're using a standard drop down value prompt. This should work:

Create a <DIV> tag around the value prompt using two HTML Items:

<div id="VP_myPrompt">

</div>


Then add another HTML Item and include the following:


<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>  

Cheers
Title: Re: tool tip for a Prompt
Post by: TheDarkKnight on 06 Sep 2010 01:53:37 AM
Thx technomorph!!..This helps.

i use list box for the value prompt. Got the code for it and it works now

Create a <DIV> tag around the value prompt using two HTML Items:

<div id="ORD">

</div>

Put another HTML Item
<script>
{

   var get_myList = document.getElementById("ORD");
   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 = "Choose status based on Order's status";
         }
      
      }
   }
}
</script>


Thx Again!!
Title: Re: tool tip for a Prompt
Post by: technomorph on 06 Sep 2010 08:51:26 AM
Happy to help. This is useful.

Just an observation (and admittedly being a bit pedantic :)), but I reckon the code could be simplified a little. Perhaps to something like the following:

   var get_myList = document.getElementById("ORD");
   var target_list = get_myList.getElementsByTagName("SELECT")[0];
   var arr_items = target_list.getElementsByTagName("OPTION");
   arr_items.title = "Choose status based on Order's status";

If the tags have definitely been defined, I'm not sure if there's much value in checking that the objects have been referenced i.e. the 'if (get_myList != null)...' and 'if (target_list != null)...' lines are probably not needed.  Also, unless there is a typo, it doesn't look like the loop is doing anything.

Cheers



Title: Re: tool tip for a Prompt
Post by: TheDarkKnight on 07 Sep 2010 12:48:30 AM
Yes....u got it right.

My report had to display the loop numbers also....missed that bit in the code..Sorry for that  :).

Thx!