Sunday, November 7, 2010

Changing the Tool Tip Text of Push Buttons dynamically in Peoplesoft.

Tool Tip text are one of the features of a push button in an application. These texts give the user a hint of information on the button’s functionality. Tool tip texts increases the user experience to a great extent.

In peoplesoft, whenever a page is requested by the user, the application server creates the page and presents it to the user. The tool tip text of the buttons present in the page are defaulted to the short name of the button by application server.

However there are scenarios where we change the label of the buttons dynamically at runtime and perform business logics based on the label of the button. In such scenarios the tool tip text will not be changing dynamically. We can write a small piece of java script to perform this functionality of changing the tool tip text based on the label of the button dynamically. This is an extended feature of peoplesoft.

How to Change the tool tip text dynamically at run time?

This can be achieved by writing a java script on the HTML area placed in the page.
The tool tip text of the button can be changed dynamically by changing the set attribute property of that button using the java script code placed in the HTML area. The set attribute property of the button refers to the tool tip text of the button on the page; the set attribute can be changed by accessing the elementId of the button in the page.

Example:
Consider we have a push button in a page with the label “Complete” which will be used to perform certain business logics. The tool tip text of this button will be “Complete Review” which is nothing but the short name of the push button field. When the Complete button is clicked, we will change the label of the button to “Reopen” and based on this label we will perform a different set of operations, but even now the tool tip text will remain as “Complete Review”. In Order to change the tool tip text to something that is relevant to reopen we need to change the set attribute property of the Complete button element Id.

To set the setattribute property we need to look into to the source of the html page that is displayed in the PIA. In the html source of the page we need to get the elementId of the “Complete” Button (e.g. element Id of “Complete” button in the html page is “EP_BTN_LINK_WRK_EP_COMPLETE_PB”). Once you have got element Id we need to insert a HTML area into the page.
Once the HTML area is inserted save the page and then double clicks on the HTML area to write the java script.

Find the sample script that will be written in the HTML area.


With the Example:

An HTML object need to be placed on the page as highlighted in the below screenshot.




This post was written by Vijaykumar Janakiraman

No comments:

Post a Comment