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
Jina ChetiaJina Chetia 

Is there any way to add a help text beside a textbox or an inputField?


Is there any way to add a help text/message beside a textbox or a inputField just like the way we have when we create any custom field through the 'Setup-Create-Objects-Any Custom Object-new Custom field' option?
There is "helpText" attribute available on pageBlockSectionItem which puts a hover next to the label,
<apex:pageBlockSectionItem helpText="hello world">
<apex:outputLabel value="name"></apex:outputLabel>
<apex:outputText value="example"></apex:outputText>

sectionHeader Component also has the "help" attribute that lets you specify link to the help page.

Help text should also automatically appear next the the field label if you've specified it on the custom field, and you're using the magic of pageBlockSection:
    <apex:inputField value="{!account.customFieldWithHelp__c}"/>

pageBlockSection will render the label with the specified help text from the field definition next to the inputField.
Jina ChetiaJina Chetia
Thanks for the help. apex:pageBlockSectionItem is working fine but the customFieldWithHelp__c is not working. It is tring to find a customField of that name with the 'withHelp' text added.
Sorry?  Are you trying to use my custom field?

You didn't tell me what your field name was so I picked something descriptive.  You have to substitute account.customFieldWithHelp__c with the reference to the custom field you have with help text.

If you're trying to add help text to something that does not have it in the definition (and you don't want to/can't add it to the field definition) then you need to use pageBlockSectionItem.  Otherwise I would suggest sticking with pageBlockSection, because it will make your page a lot cleaner and take care of localized labels for your fields.