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
bozotheclownbozotheclown 

ActionRegion & Awkwardly Displayed InputField Label

Hello.  I have seen a couple of related posts - but none of them seem to address my specific issue.

 

I have added an actionRegion around an inputField.  The behavior works as desired - but the label of the inputField ("Region Label")  disappears.  I have tried to add the label via OutputLabel - but the desired "Region Label" now appears ABOVE the inputField picklist instead of immediately to the left of it.

 

Can anyone suggest where I am going wrong?


Thanks in advance.

 


<apex:actionRegion >
  <apex:outputLabel value="Region Label" for="RegPickList">
    <apex:inputField value="{!xxx.CustomerRegion__c}" id="RegPickList" required="true">
      <apex:actionSupport event="onchange" rerender="RegionDetailPanel"/>
    </apex:inputField></apex:outputLabel>
</apex:actionRegion>

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

I can suggest you a very good example , how to use action region. Please compare your code with it.

 

http://www.tgerm.com/2010/09/visualforce-actionregion-deep-dive.html

All Answers

Shashikant SharmaShashikant Sharma

I can suggest you a very good example , how to use action region. Please compare your code with it.

 

http://www.tgerm.com/2010/09/visualforce-actionregion-deep-dive.html

This was selected as the best answer
Platy ITPlaty IT

I've had some issues with layouts being changed on reRender, and I suspect it's not the region per say causing it, but maybe something to do with the layout around that region.  Try wrapping that outputLabel in an outputPanel with the layout = "block".  And if that alone doesn't do it, do add a style="width:200px" (or whatever width works) so that inputField isn't forced to wrap around on the reRender.

bozotheclownbozotheclown

Thanks to both of you all for the help - both ideas helped get me to a resolution.

 

In short, I enclosed my action region witin a PageBlockSectionItem...and then I moved the OutputText between the AR and PBS lines.  This all is within an OutputPanel.  These steps placed the field title next to the picklist.

 

Thanks again.

DownstairsBDownstairsB

You can put the ActionRegion tags just around the input field itself.  Then wrap the whole thing in a PageBlockSectionItem (see below).  Then the field and label are rendered normally, like the other fields.  Little late for your problem but it's a better solution than what that other guy posted.

 

<apex:pageblockSectionItem >

 

<apex:outputLabel value="Region Label" for="RegPickList" />

 

<apex:actionRegion >

     <apex:inputField value="{!xxx.CustomerRegion__c}" id="RegPickList" required="true">
          <apex:actionSupport event="onchange" rerender="RegionDetailPanel"/>
     </apex:inputField>

</apex:actionRegion>

 

</apex:pageblockSectionItem >

Rajeshwar PatelRajeshwar Patel
Thanks DownstairsB . Its works For me