How to display the help text on Visualforce Page?

when we using the apex:inputField and apex:outputField shows their help Text bubble when nested within a pageBlockSection component automatically like:

<apex:pageBlock>
<apex:pageBlockSection>
<apex:pageBlockSectionItem helptext=”{!$ObjectType.Account.Fields.Phone.InlineHelpText}”>
<apex:outputLabel value=”{!$ObjectType.Account.Fields.Phone.Label}” />
<apex:inputField value=”{!Account.Phone}” />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>

Syntax to display the Help Text in VF Page:
{!$ObjectType.objectName__c.Fields.fieldName__c.inlineHelpText}

Here
objectName__c —> SFDC OBJECT API
fieldName__c —> Field API

if we not using the pageBlockSection, then the standard help text bubble is not displayed:

1) If we use “Label” attribute of “apex:outputField” , then helpText bubble is not displayed
2) If we set “showHeader=false”  of <aapex:Page>, in that case also helpText bubbles is not displayed

We can access the help text within an expression by using the respective $ObjectType global variable in visualforce page and here is the example:

<div id=”mainContent”>
Sample helpText bubbles Example
<span>
<img src=”/s.gif” alt=”Help” title=”{!$ObjectType.Account.Fields.Phone.InlineHelpText}”/>
</span>
</div>

By Providing “$ObjectType.Account.Fields.myField__c.inlineHelpText” in <img> tag as TITLE attribute then the helpText will be displayed as ToolTip Text in Image.

Source:

http://www.salesforce.com/docs/developer/pages/Content/pages_compref_pageBlockSectionItem.htm

(1004)

Written by 

I am Sakthivel Madesh, a certified Salesforce Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 13x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply