Skip to main content
I have a few rerenders on a page that work fine.  I was refreshing the entire page for the others.. however, I don't want to null out the fields that were previously populated if a required field has not yet been populated.

I'm trying to only display the 'Special Accommodation Instructions' pageblock if there is a value in the multi select list on the page named 'Special_Accommodations__c'   Any help would be greatly appreciated!!!!

 <apex:pageBlockSectionItem >

                    <apex:outputLabel value="Special Accommodations"/>

                    <apex:actionregion >                    

                        <apex:inputfield value="{!case1.Special_Accommodations__c}" > 

                            <apex:actionSupport event="onchange" rerender="SAI, abc"  status="overlayStatus" />  

                        </apex:inputfield>

                    </apex:actionregion>

                </apex:pageblocksectionItem>

            </apex:pageBlockSection>

             <apex:outputPanel id="SAI">

           <apex:pageBlockSection title="Special Accommodation Instructions" columns="1" rendered="{!case1.Special_Accommodations__c <> null}" >

             <apex:pageBlockSectionItem >

                    <apex:outputPanel >

                        <div class="requiredInput">

                            <div class="requiredBlock"></div>                            

                            <apex:inputtextarea value="{!case1.Special_Accommodation_Instructions__c}" 

                                cols="100" rows="5"/>                              

                        </div>

                    </apex:outputPanel>

                </apex:pageBlockSectionItem>

            </apex:pageBlockSection>

            </apex:outputpanel>
1 answer
  1. Oct 6, 2016, 4:49 PM
    Hi Fredka,

    Can you please try the following

    1) create a property in your controller to controll the visibility of the section

    public Boolean isVisible {get;set;}

    public pageReference checkVisible()

    {

    if(case1.Special_Accomodation_Instructions__c != null && case1.Special_Accomodation_Instructions__c != '')

    {

    isVisible = true;

    }

    }

    2) Update your VF page to use this property

     

    <apex:pageBlockSectionItem >

    <apex:outputLabel value="Special Accommodations"/>

    <apex:actionregion >

    <apex:inputfield value="{!case1.Special_Accommodations__c}" >

    <apex:actionSupport event="onchange" rerender="SAI, abc" status="overlayStatus" action="{!checkVisible}" />

    </apex:inputfield>

    </apex:actionregion>

    </apex:pageblocksectionItem>

    </apex:pageBlockSection>

    <apex:outputPanel id="SAI">

    <apex:pageBlockSection title="Special Accommodation Instructions" columns="1" rendered="{!isVisible}" >

    <apex:pageBlockSectionItem >

    <apex:outputPanel >

    <div class="requiredInput">

    <div class="requiredBlock"></div>

    <apex:inputtextarea value="{!case1.Special_Accommodation_Instructions__c}"

    cols="100" rows="5"/>

    </div>

    </apex:outputPanel>

    </apex:pageBlockSectionItem>

    </apex:pageBlockSection>

    </apex:outputpanel>

     
0/9000