5

The question is quite simple, yet, I'm unable to answer it myself. Is there any solution to stop my label from a selectRadio/selectList/anything from disappearing everytime I use an action region? I need to use it due to having required fields whenever one of these radio values is changed but it is breaking my my design.

<apex:pageBlockSection id="Info" title="Some Information" columns="2">
   <apex:actionRegion >
       <apex:selectRadio id="taxType" label="Why does this disappear?" value="{!answer}">
           <apex:selectOptions value="{!itemsAnswer}"/>
           <apex:actionSupport event="onchange" rerender="Info" status="status"/>
       </apex:selectRadio>                       
   </apex:actionRegion>
   <apex:outputLabel >Is the Tax paid at the same time as the Cost?</apex:outputLabel>
</apex:pageBlockSection>
  • Hello once again. Just came by to say I couldn't find a solution ever since I made this topic, so I just wanted to know to those that see this post if this is actually possible to workaround. – Rui Rocha Nov 15 '13 at 11:27
  • Hi Rui, I know this is from last year but if these answers work could you mark one as accepted? – Matt Lacey Oct 4 '14 at 1:06
3

You need to use an <apex:pageBlockSectionItem> in order to preserve the formatting.

Try this:

 <apex:pageBlockSection id="Info" title="Some Information" columns="2">
      <apex:outputLabel for="taxType" value="Why does this disappear?" />
      <apex:pageblocksectionitem>
          <apex:actionRegion >
               <apex:selectRadio id="taxType" value="{!answer}">
                   <apex:selectOptions value="{!itemsAnswer}"/>
                   <apex:actionSupport event="onchange" rerender="Info" status="status"/>
               </apex:selectRadio>                       
          </apex:actionRegion>
      </apex:pageblocksectionitem>
      <apex:outputLabel >Is the Tax paid at the same time as the Cost? </apex:outputLabel>
  </apex:pageBlockSection>
| improve this answer | |
-1

I don't have enough insight or whatever it takes to comment, but this haunts me to this day and I still don't have a solution as well. --I've removed my gripe--

EDIT: EUREKA!!! This worked for me: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000969VIAQ

EDIT: To clarify the link: You need to wrap the input field in a pageBlockSectionItem, so the order of things would be: pageBlockSectionItem, then add the label, then the output region, then the input field:

<apex:pageBlockSectionItem>
    <apex:outputLabel.../>
    <apex:actionRegion...>
        <apex:inputField...>
            <apex:actionSupport />
        </apex:inputField>
    </apex:actionRegion>
</apex:pageBlockSectionItem>
| improve this answer | |
  • To provide a more useful answer, it would be helpful if you added some commentary beyond just the link. You might even earn some points for your answer that would give you some "Karma" so you could make comments in the future. ;) – crmprogdev Jul 30 '14 at 18:38
  • I guess I figured the post I linked to after I edited answers the question. Not sure how much I need to clarify with comments. Do I need to explain the link? Help me help you all here, I want to be a good player :) – lifewithryan Aug 4 '14 at 15:34
  • 1
    Its always a good idea to provide a summary of what the solution is that's in the link should the link ever disappear for some reason or other. That prevents the solution from being totally lost to those who might come here in search of it in the future. – crmprogdev Aug 14 '14 at 17:50
  • 1
    I've edited the comment again to explain what is in the link. Again, sorry. – lifewithryan Oct 2 '14 at 19:24
  • @lifewithryan Thanks for updating the answer again to include extra info. I just cleaned up the code formatting a little. Given that JimRae got the right answer for this a few months back it'd be great if you could mark his answer as accepted! – Matt Lacey Oct 3 '14 at 5:25

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.