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
sanshasansha 

Label format issue when wrapping input field in output panel

The below code shows the field label (Field1 Label) above the field ( Object__c.Field1__c). The field Field1__c is a multiselect input field.
 
<apex:PageBlockSectionItem >
                      <apex: outputPanel>
                      <apex: outputLabel value="Field1 Label" for="id"/>                     
                      <apex: inputField id="id" value="{!Object__c.Field1__c}"/>
                      <apex: actionSupport event="onmouseover" action="{!calc}" rerender="SectionId" status="status"/>
                      <apex: actionStatus id="status" startText="updating page..." />
                      </apex: outputPanel>
</apex:PageBlockSectionItem>
 
 
I need the field label to appear to the left side of the field and having the same format as that of any other input field.
 
Please assist.
 
 


Message Edited by sansha on 12-09-2008 07:33 AM
jwetzlerjwetzler
Code:
<apex:pageBlockSectionItem>
  <apex:outputLabel value="{!$ObjectType.Object__c.fields.Field1__c.label}" for="id"/>
<apex:outputPanel>
<apex:inputField value="{!Object__c.Field1__c}" id="id"/>
<apex:actionSupport.../>
<apex:actionStatus.../>
</apex:outputPanel>
</apex:pageBlockSectionItem>

 
When pageBlockSectionItem has one child component (in your case, outputPanel), it is going to make that entire component span the width of the cell (both the label and data cell) and then style it like a data cell.  So you want your label to be the first child component in your pBSI because it will then get label styling.

The second component will be your data component, so that's where you want your inputField to go.

I am not sure what you're trying to achieve with the actionSupport... in your example it will fire when you mouse over both the label and the field.  Is that what you're going for?  With my example above it will only fire when moused over the outputPanel surrounding the inputField.  If you want it to fire when mousing over the label too then I think in order to retain the styling pBSI gives you you'll want to add another identical actionSupport as a child component of your outputLabel.
sanshasansha

Thanks a lot Jill. It worked. I needed the actionsupport to fire only when I mouseover the field.

Is there a way by which I can show a busy cursor when then function in the action support is getting executed ?

jwetzlerjwetzler
Nothing built into Visualforce but I think you can do it in javascript.