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
JN22JN22 

HelpText Line Break

Hello,

 

I have a VF page where I am using pageBlockSection components.  I am also including help text in these components but I can't figure out how to include line breaks in my help text.  I know I can do them as part of the custom field help text, but I am limited to 255 characters and there are some fields where I need more.  Does anyone know how to do this?  My sample line is below:

 

<apex:pageBlockSectionItem helpText="This is a test<br>Testing<br>testing.">

Best Answer chosen by Admin (Salesforce Developers) 
Puja_mfsiPuja_mfsi

Hi,

You can use the below code 

 

<apex:pageBlock>
        <apex:pageBlockSection>
                 <apex:pageblockSectionItem>
                             <span class="helpButtonOn" id="Name-_help">
                                      <label>Name</label>
                                      <img src="/s.gif" alt="" class="helpOrb" title=""/>
                                      <script type="text/javascript">sfdcPage.setHelp('Name', 'First line <br/> Second line');</script>
                             </span>
                             <apex:inputField value="{!Account.Name}"/>
                </apex:pageblockSectionItem>
        </apex:pageBlockSection>
</apex:pageBlock>

 

If this post is helpful please throw Kudos(Click on the start at left).If this post solves your problem kindly mark it as solution.

All Answers

JN22JN22

Thanks Kiran.  I saw that post and I've been researching how I might accomplish it, but have not had any luck.  Would you have a sample of how it would work?  Thanks.

JN22JN22

Thanks again, but I don't have a problem getting a tooltip to show up.  My issue is how to put a line break or carriage return within a tooltip.  Those 2 links just show different ways to create the tooltip. Thanks

Puja_mfsiPuja_mfsi

Hi,

You can use the below code 

 

<apex:pageBlock>
        <apex:pageBlockSection>
                 <apex:pageblockSectionItem>
                             <span class="helpButtonOn" id="Name-_help">
                                      <label>Name</label>
                                      <img src="/s.gif" alt="" class="helpOrb" title=""/>
                                      <script type="text/javascript">sfdcPage.setHelp('Name', 'First line <br/> Second line');</script>
                             </span>
                             <apex:inputField value="{!Account.Name}"/>
                </apex:pageblockSectionItem>
        </apex:pageBlockSection>
</apex:pageBlock>

 

If this post is helpful please throw Kudos(Click on the start at left).If this post solves your problem kindly mark it as solution.

This was selected as the best answer
JN22JN22

Thanks Puja.  I inserted your code and while it gives me the help orb, it does not show the text in the script when I mouseover it.  Thanks.

Avidev9Avidev9

The code does the work!

 

<apex:pageblockSectionItem >
                             <span class="helpButton" id="LastName-_help">
                                      <label>Name</label>
                                      <img src="/s.gif" alt="" class="helpOrb" title=""/>
                                      <script type="text/javascript">sfdcPage.setHelp('LastName', 'First line <br/> Second line');</script>
                             </span> 
                             <apex:inputField value="{!Contact.LastName}"/>
                </apex:pageblockSectionItem>

 Make sure you set the highlighted values. Best way will be setting the API name of the field there

JN22JN22

Ah, I found the issue.  I had my help text on separate lines to make it more readable and it wasn't being read.  Thanks for all the help, it works now!

Mitesh SuraMitesh Sura
Is there a way to change the size of the tooltip? If possible, the yellow the background color as well?
Maciej SobkowiczMaciej Sobkowicz
I think it would be better to use Custom Labels here. Create a new Custom Label, let's say TestLabel with value equal to:
This is a test
Testing
testing.
and then use it on your VF page:
<apex:pageBlockSectionItem helpText="{!$Label.TestLabel}">
I recommend it because it's safer and easier to make changes later on (no deployment required).
Creating HTML and playing with Javascript is quite risky because when Salesforce.com changes something it might be no longer supported.