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
fredkafredka 

Rerender Question

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>
Prateek Singh SengarPrateek Singh Sengar
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>