When you enter Help Text into any field in Salesforce, the user is able to view it by hovering their mouse cursor over the field’s icon in a standard view page. But how can you access that help text in a Visualforce page?
The easiest solution is to use the helpText attribute in the < apex:PageBlockSectionItem > tag, but in order to do this, you need to include a < apex:PageBlockSection > nested in a < apex:PageBlock > tag as well. We wanted to avoid using Page Blocks for our page, so this left us scrambling for some kind of alternative to the helpText attribute.
Here comes CSS to the rescue!
By using the “helpOrb” class supplied by the standard SFDC stylesheets, and adding our own CSS on top of that, we were able to replicate the look and feel of the hover text seen in other pages.
In this example, we took the Help Text entered in the Contact’s “Account Name” field, but you can substitue it with your own text where you see fit.
As always, please be careful about using this code, as calling on the “helpOrb” class is not officially supported by Salesforce. They can very easily break it in a future release and have no obligation to support it at all.
Contact us by adding a comment below, or @ reply us on Twitter if you have any questions. We’re on Facebook too!