+ Start a Discussion
SushupsiSushupsi 

Help text In Visual Force

Hi,

 

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.

SteveBowerSteveBower

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="{!CurrentProduct.prod.Category__c}"/> <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. 

 

https://sites.secure.force.com/ideaexchange/ideaView?id=087300000006n5hAAA

 

 

 

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>

 

 

 

sonninhosonninho

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

 

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_compref_pageBlockSectionItem.htm?

pjcocopjcoco

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

{!$ObjectType.Account.Fields.Phone.InlineHelpText}

 

 

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}" />
</apex:pageBlockSectionItem>

 

GuyClairboisGuyClairbois

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">

 

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