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
AnchalGoelAnchalGoel 

Using custom field help in visual force

We are creating a form with input fields, and we want the ability to display the hover over help text for every input field. We are currently defining the input field within the <table> tag enveloped in a <pageBlock> but have not been able to display the help text using this method.
 
However, we also tried using <Page Block Section> to envelope the input fields and were able to display the hover over text, but were limited to using only two columns per section and were unable to define custom labels for the input fields. This forced us to switch to the <table>tag. 
Is there a way for us to display the hover over text while using custom labels and having more than two columns?
Luke@TWSLuke@TWS
Code:
<apex:pageBlockSection columns="4">

 How custom do you want the field labels to be?


Message Edited by Luke@TWS on 11-21-2008 06:31 AM
jwetzlerjwetzler
Right, you should be able to specify your columns in the pageBlockSection and still get your hover text (yes there are a few known styling issues here though).

However if you need to specify your own labels I think you lose the hover text, though you can still specify it yourself.  Use pageBlockSectionItem to supply your own label, and then use the helpText attribute to supply the helpText.

You should not need to drop into any <table> elements to get this to work.
AnchalGoelAnchalGoel

<apex pageBlockSection columns="4">

<apex pageBlockSectionItem labelTitle="helo" helpText="andrew">

<b><apex:outputLabel value="Last Name"/></b>

</apex pageBlockSectionItem>

<apex:outputPanel >

<apex:inputField value="{!case.Last_Name__c}" />

</apex:outputPanel>

</apex pageBlockSectionItem>

</apex pageBlockSection>

I tried using this but the help Text doesnt get displayed. Any suggestions?
 
We are looking into PageBlockTable and DataTable now
jwetzlerjwetzler
Your pageBlockSectionItem should contain your label and your field.  Please review the documentation for this component.

Code:
<apex:page standardController="account">
<apex:form>
  <apex:pageBlock>
    <apex:pageBlockSection>
    <apex:pageblockSectionItem helpText="my help text">
    <apex:outputLabel value="My Label" for="name"/>
    <apex:inputField value="{!account.name}" id="name"/>
    </apex:pageblockSectionItem>
    </apex:pageBlockSection>
  </apex:pageBlock>
</apex:form>
</apex:page>

 If you only specify one child in your pBSI it's going to treat it like a field, thus it's not going to display your help text.

AnchalGoelAnchalGoel
This is the code we are currently using and a picture of what we are trying to do.
 
 
 
Code:
<table>

<tr>
<td rowspan="3"> <b> 10. Location </b></td>
<td colspan="3"><b> Street </b><apex:inputtext size="80" value="{!case.Street__c}" /></td>
<td ><b> Floor #</b></td>
<td ><b> Room #</b></td>
</tr>

<tr>
<td><b>City</b> &nbsp; <apex:inputtext size="30" value="{!case.City__c}" /></td>
<td width="20%"><b>State</b> &nbsp; <apex:inputfield value="{!case.State__c}" /></td>
<td><b>Zip Code</b> &nbsp; <apex:inputtext size="5" value="{!case.Zip_Code__c}" /></td>
<td><apex:inputtext size="5" value="{!case.Floor__c}" /></td>
<td><apex:inputtext size="5" value="{!case.Room__c}" /></td>
</tr>

<tr>
<td colspan="5"> <apex:inputfield value="{!case.Region__c}" /> &nbsp;&nbsp; <b>Region</b> &nbsp;&nbsp; <apex:inputfield value="{!case.Regional_Location__c}" /> </td>
</tr>
</table>

 

I tried using pageBlockSectionItem but get an error that says <pageBlockSectionItem> component may  have no more than two child components

Code:
 <apex:pageBlockSection title="Section 1" columns="4">
<apex:pageBlockSectionItem helpText="andrew"> 
 <b><apex:outputLabel value="Last Name"/></b>
<apex:inputField value="{!case.Last_Name__c}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>       


 

 


 
jwetzlerjwetzler
Take the bold tags out.  We bold the label for you anyway so I don't see why you need to do that.  If you need any other styling use the style or styleClass attribute on outputLabel.
EvaDEvaD

If you are looking to get the Help Text with the orange question mark bubble, you can do this:

 

The helpButton id is the object and field plus -_help as in Account.CustomerShipTo__c-_help

 

<TD class="labelCol"> <span class="helpButton" id="Account.CustomerShipTo__c-_help">Customer Ship To
<img class="helpOrb" src="/s.gif" alt="" title=""/>


<script  type="text/javascript">
sfdcPage.setHelp('Account.CustomerShipTo__c', '{!$ObjectType.Account.Fields.CustomerShipTo__c.inlineHelpText}');
</script>
</span></TD>

jwetzlerjwetzler

That may work but if we change the help text javascript or the CSS that inserts the question mark bubble your page will break.

kvinkvin

Using the pageBlockSectionItem is there a means to maitain the formatting of help text. For instance here I have muti line Help text defining the values of picklist. Like

 

A - Use this for 

B - Use this for

C - Use this for.

 

How can I maintain this format in the Help Bubble Text of visual force page. The standard help is not suffice here as the help text exceeding 255 characters. 

hemantgarghemantgarg

Thanks a lot, its a great help for us.