PeopleSoft - Dynamic Tooltips

This is the last post on achieving dynamism in ToolTipText using qTips in PeopleSoft. If you are jumping to this post right from the internet, make sure you check out the previous posts before reading this.

We have brought in flashy tooltip text in PeopleSoft, but for the whole of the process we have been using constant HTML. If you want to make your tooltips dynamic, you need to write some code for that. First, let us frame a simple requirement. If the logged in user is VP1, then show the tooltip as

"You have full rights on this page".

Otherwise, show it as

"Hi there, welcome".

To do this, create a HTML definition and copy the code as shown below

<script type="text/javascript" src="/<domainname>/script/jquery.1.3.2.min.js"></script>
<script type="text/javascript" src="/<domainname>/script/jquery.qtip-1.0.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#TEST_REC_FIELD1").qtip({ => TEST_REC_FIELD1, field for which we intend to show a tooltip
style: {
      name: 'blue'
   },
content: "%bind(:1)", => Note that we are binding the contents dynamically here. This will be passed from the code.
 position: {
      corner: {
         target: 'rightBottom',
         tooltip: 'bottomLeft'
      }
   }

});
});
</script>

Save this definition as QTIP_HTML and insert the following piece in the page activate peoplecode.

If %UserId = "VP1" Then
   TEST_REC.HTMLAREA.Value = GetHTMLText(HTML.QTIP_HTML, "You have full Rights on this page") => We pass the input dynamically here.
Else
   TEST_REC.HTMLAREA.Value = GetHTMLText(HTML.QTIP_HTML, "Hi there, welcome") => and here.
End-If;

This will ensure that our tooltip changes dynamically based on any condition we add from PeopleSoft. Sample screenshots are provided below

That completes our series of bringing a new dimension of presenting tooltips in PeopleSoft. We were able to bring in both static as well as dynamic content as tooltips and created a new look to the way we show them in PeopleSoft.

If you have any questions, please do post them in the comments section. Would be happy to resolve them.

2 comments:

  1. Thanks a lot for your valuable tips.Buti am not able to implement the same.can you explain it again in detail.
    I have a delivered field empld and a record empl_dtl.Now i wann change its tooltip dynamically depending upon different lables,
    how do i do???
    thanks in advance

    ReplyDelete
  2. @Paritosh
    Did you put proper libraries in your webserver as explained?..Can you tell us what exactly you are trying and where you are finding it difficult? (any error messages that you get in this process?)

    ReplyDelete