function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Help text In Visual Force



Can someone suggest if there is any helptext kind of thing available in the Visual Force.


This is regarding the help icon which, when hovered by a mouse gives a help text explanation


which is present in the Standard objects & Custom Objects for the standard fields in them.


Is there a way of achieving this through javascript?


Please give me pointers in this issue. TIA.


I also wanted to include Help text in the form of a Hover.  I don't think it can be done using strict VisualForce tags.  However, you can take a look at the HTML that is generated by Salesforce when they do the Hover and copy it into your VF page.


So, for example, this code puts the help icon with hover behavior along with the entries in a column of a pageBlockTable.



<apex:column headerValue="Category"> <span id="Product2_help" class="helpButton"> <apex:outputField value="{!}"/> <img class="helpOrb" title="" alt="" src="/s.gif"/> <script type="text/javascript"> sfdcPage.setHelp('Product2', 'FB (Field Business) \r\u003Cbr\u003EFS (Field Science) \r\u003Cbr\u003EIHB (In-House Business) \r\u003Cbr\u003EIHS (In-House Science) \r\u003Cbr\u003EIHO (In-House Other)'); </script> </span> </apex:column>


 The span is of class "helpButton".  The outputField is my Category data item.  The sfdcPage.setHelp takes "xxx" as it's first argument and then looks for xxx_Help.   The second field is what comes up in the help hover, it's easiest to just copy the HTHML from a standard page that Salesforce renders.



I also created a idea to add Hover behavior.




Hope this helps, Steve.


p.s. Note, you can put this in the Column Header facet instead of in each row if you like...



<apex:facet name="header"> <span id="Category_help" class="helpButtonOn"> Comp Type <img class="helpOrb" title="" alt="" src="/s.gif"/> <script type="text/javascript"> sfdcPage.setHelp('Category', 'Order types. Hand Delivered \r\u003Cbr\u003EAC=ADC Comp\r\u003Cbr\u003EDC=Desk Copy\r\u003Cbr\u003ERC=Review\r\u003Cbr\u003EMC=Marketing\r\u003Cbr\u003EHC=Hand\r\u003Cbr\u003ERS=Rep Sample'); </script> </span> </apex:facet>





You can also use the attribute helpText in the standard component  <apex:pageBlockSectionItem helpText="This is a help text">


After some fiddling around I found a way to get the helptext of a specific field in Visualforce.



// For example this is the Helptext of the Phone field on Account




this would then be:

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



Hi all,

When using the custom span solution, I found out that in some cases (non-standard fields?) you have to put an extra dash:


<span id="group-_help" class="helpButton">


instead of:


<span id="group_help" class="helpButton">


Probably says it in the documentation somewhere, but the PageBlockSectionItem must be a direct descendent of a PageBlockSection, not in an Output panel say!