2

I have a Visualforce page which consists of questions and inputFields below the question .I want to use Help Text for that field so as to display the Text in place of question.How do i achieve it without using <apex:pageBlockSectionItem> ? My code:

<apex:pageBlock >
   <apex:pageBlockSection >
      <div class="questions">
         <apex:pageBlockSectionItem helptext="{!$ObjectType.Survey__c.Fields.Impact_of_visit__c.InlineHelpText}">
            {!$ObjectType.Survey__c.Fields.Impact_of_visit__c.label}
             <apex:outputLabel value="{!$ObjectType.Survey__c.Fields.Impact_of_visit__c.Label}" />
             <apex:inputField value="{!decision.Impact_of_visit__c}" />
         </apex:pageBlockSectionItem>
      </div>
  </apex:pageBlockSection>
</apex:pageBlock>

Its that i have to display 5 questions from the help text of the particular field.And if i use it in <apex:pageBlockSectionItem> ,i get blocks in the page which i dont want to display on the page.

  • Have you already tried something you could show ? – Samuel De Rycke Oct 14 '14 at 9:10
  • And could you clarify why you don't want to use the <apex:pageBlockSectionItem> ? – Guy Clairbois Oct 14 '14 at 9:22
1
We can add helptext in PaeblockTable as well using jquery:

<apex:page standardController="Case">
<head>
    <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
    <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>   
    <apex:form >
      <apex:pageBlock mode="edit"  tabStyle="Case" >                                     
          <apex:pageBlockSection title="Subject" columns="1" id="subject" collapsible="false" >
              <!-- Configure your help text from Field Help text-->                                                                         
              <apex:pageBlockSectionItem helpText="{!$ObjectType.Case.fields.subject.inlineHelpText}">
                  <apex:outputLabel value="{!$ObjectType.Case.fields.subject.label}"/>                                       
                  <apex:outputPanel >
                      <apex:inputField value="{!case.subject}" />               
                  </apex:outputPanel>                                         
              </apex:pageBlockSectionItem>
           </apex:pageBlockSection>
       </apex:pageBlock>

       <script>
                 var elementToAppend = '<span class="helpButton" id="example-title-_help"><img src="/s.gif" class="helpOrb" style="width: 20px!important;height:15px!important;"/></span>';
                 $("[id$='subject']").find('h3').after(elementToAppend);
                 sfdcPage.setHelp('example-title', 'Demo help Text');
        </script>
    </apex:form>

</apex:page>

Code referred from: http://salesforcebytes.blogspot.in/2015/01/add-helpbutton-in-pageblock-using.html
| improve this answer | |
6

Do you mean you want the field helptext displayed as a label? You could do it like this:

<apex:pageBlock >
   <apex:pageBlockSection >
         <apex:pageBlockSectionItem >
             <apex:outputLabel value="{!$ObjectType.Survey__c.Fields.Impact_of_visit__c.InlineHelpText}" />
             <apex:inputField value="{!decision.Impact_of_visit__c}" />
         </apex:pageBlockSectionItem>
  </apex:pageBlockSection>
</apex:pageBlock>

So in the pageblocksectionitem you can put any values. The first component will be used as label, the second as field value.

| improve this answer | |
1

One more way by which you can use helptext as field label and get rid of <apex:pageblockSectionItem> too by using label attribute of inputField. Try this:

<apex:pageBlock >
   <apex:pageBlockSection >
       <apex:inputField value="{!decision.Impact_of_visit__c}" label="{!$ObjectType.Survey__c.Fields.Impact_of_visit__c.InlineHelpText}" />
   </apex:pageBlockSection>
</apex:pageBlock>

But still if it is about blocks in page, then avoid using <apex:pageBlockSection>. Try this way:

<apex:pageBlock >
   <div class="questions">
      <apex:outputLabel value="{!$ObjectType.Survey__c.Fields.Impact_of_visit__c.InlineHelpText}" />
      <apex:inputField value="{!decision.Impact_of_visit__c}" />
   </div>
</apex:pageBlock>
| improve this answer | |
  • @simmi if you like an answer you can show your appreciation for the person taking their time to answer it by clicking the 'up' arrow next to the answer. And the answer that answers your question best can be 'accepted' by you so that future users with the same problem can quickly find the best solution. – Guy Clairbois Oct 14 '14 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.