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
Tyler HarrisTyler Harris 

ActionSupport not rerendering

I can't figure out why my page section is not rerendering. The debug is saying it should be returning true/false based on the checkbox, but the section is stil showing. I need to rerender the OuputPanel with the Id 'changem'.  I want to show/hide based on the boolean value of the inputCheckbox "{!flip}".

Visualforce
 
<apex:page controller="StoreFront2" showHeader="false" sidebar="false" >
    <apex:stylesheet value="{!URLFOR($Resource.styles)}"/>
    <h1>Confirm Page</h1>
  <apex:form >
      <apex:outputPanel rendered="{!flip}" id='changem'>
      <apex:pageBlock>
     	<apex:pageblocksection>
          Find Existing Contact <apex:inputField value="{!ct.Buyer__c}" ></apex:inputField><br/><br/>
          </apex:pageblocksection>
           
      </apex:pageBlock>
          </apex:outputPanel>
      <apex:outputPanel >
      <apex:pageBlock >
          
          <apex:outputPanel>
          <apex:pageBlock>
              Find Existing Buyer<apex:inputCheckbox value="{!flip}" ><apex:actionSupport event="onchange" reRender='changem' action='{!doShow}' status='StatusChange'/><apex:actionStatus startText='Updating page' id='StatusChange'/></apex:inputCheckbox><br/>
          </apex:pageBlock>
          </apex:outputPanel>
          
          	First Name: <apex:inputText title="First Name" /><br/>
          	Last Name: <apex:inputText title="Last Name" /><br/>
          	Email Address: <apex:inputText title="Email Address"/>
          
      		</apex:pageBlock>
          </apex:outputPanel>
      
     <apex:dataTable id="cart" value="{!cart}" var="carti" rowClasses="odd,even">
			
   <apex:column headerValue="ID" rendered="false">
       <apex:outputText value="{!cart[carti].merchandise.Id}" >
       </apex:outputText>
          </apex:column>
          <apex:column headerValue="Product">
              <apex:outputText value="{!cart[carti].merchandise.name}">
          	
         </apex:outputText>
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!cart[carti].merchandise.price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:outputText value="{!cart[carti].count}"/>
          </apex:column>
      </apex:dataTable><br/>
      <apex:commandButton action="{!back}" value="Back"/>
    </apex:form>
  
</apex:page>

Apex
public virtual class StoreFront2 {    

public StoreFront2(){
        ct=new Purchases__c();
        flip=false;
        system.debug(flip);
    }
   
    public void doShow(){
        if(flip){
            flip = false;
            
        }
        else{
            flip = true;
            system.debug(flip);
        }
          
    }

}
Log when I check the box
16:21:23:039 SYSTEM_MODE_ENTER true

16:21:23:040 VF_APEX_CALL j_id15|{!doShow}|PageReference: none
 
KaranrajKaranraj
Tyler - Problem is you are using same variable for rerendering and for the value of checkbox field . Add one more boolean variable in your controller class and use that variable for shoe/hide the outpanel section. Try the updated below code

Apex Class:
 
public virtual class StoreFront2 {    
 public boolean flip {get;set:}
 public boolean flag {get;set;}
 public StoreFront2(){
       ct=new Purchases__c();
       flip=false;
}
    public void doShow(){
        if(flip){
            flag = false;           
        }
        else{
            flag = true;
        }
          
    }

}

Visualforce page
 
<apex:page controller="StoreFront2" showHeader="false" sidebar="false" >
    <apex:stylesheet value="{!URLFOR($Resource.styles)}"/>
    <h1>Confirm Page</h1>
  <apex:form >
      <apex:outputPanel rendered="{!flag}" id='changem'>
      <apex:pageBlock>
     	<apex:pageblocksection>
          Find Existing Contact <apex:inputField value="{!ct.Buyer__c}" ></apex:inputField><br/><br/>
          </apex:pageblocksection>
           
      </apex:pageBlock>
          </apex:outputPanel>
      <apex:outputPanel >
      <apex:pageBlock >
          
          <apex:outputPanel>
          <apex:pageBlock>
              Find Existing Buyer<apex:inputCheckbox value="{!flip}" ><apex:actionSupport event="onchange" reRender='changem' action='{!doShow}' status='StatusChange'/><apex:actionStatus startText='Updating page' id='StatusChange'/></apex:inputCheckbox><br/>
          </apex:pageBlock>
          </apex:outputPanel>
          
          	First Name: <apex:inputText title="First Name" /><br/>
          	Last Name: <apex:inputText title="Last Name" /><br/>
          	Email Address: <apex:inputText title="Email Address"/>
          
      		</apex:pageBlock>
          </apex:outputPanel>
      
     <apex:dataTable id="cart" value="{!cart}" var="carti" rowClasses="odd,even">
			
   <apex:column headerValue="ID" rendered="false">
       <apex:outputText value="{!cart[carti].merchandise.Id}" >
       </apex:outputText>
          </apex:column>
          <apex:column headerValue="Product">
              <apex:outputText value="{!cart[carti].merchandise.name}">
          	
         </apex:outputText>
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!cart[carti].merchandise.price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:outputText value="{!cart[carti].count}"/>
          </apex:column>
      </apex:dataTable><br/>
      <apex:commandButton action="{!back}" value="Back"/>
    </apex:form>
  
</apex:page>



 
Tyler HarrisTyler Harris
It looks like it's trying to rerender, but the fields are not showing. 

Apex
public virtual class StoreFront2 { 
public Boolean flip{get;set;}
    public Boolean flag{get;set;}

    public Purchases__c ct{get;set;}
    
    public StoreFront2(){
        ct=new Purchases__c();
        flip=false;
        system.debug(flip);
    }
   
    public void doShow(){
        if(flip){
            flag = false;
            
        }
        else{
            flag = true;
            system.debug(flip);
        }
          
    }
}

Visualforce
<apex:page controller="StoreFront2" showHeader="false" sidebar="false" >
    <apex:stylesheet value="{!URLFOR($Resource.styles)}"/>
    <h1>Confirm Page</h1>
  <apex:form >
      <apex:outputPanel rendered="{!flag}" id="changem">
      <apex:pageBlock >
     	<apex:pageblocksection >
          Find Existing Contact <apex:inputField value="{!ct.Buyer__c}" ></apex:inputField><br/><br/>
          </apex:pageblocksection>
           
      </apex:pageBlock>
          </apex:outputPanel>
      <apex:outputPanel >
      <apex:pageBlock >
          
          <apex:outputPanel >
          <apex:pageBlock >
              Find Existing Buyer<apex:inputCheckbox value="{!flip}" ><apex:actionSupport event="onchange" reRender="changem" action="{!doShow}" status="StatusChange"/><apex:actionStatus startText="Updating page" id="StatusChange"/></apex:inputCheckbox><br/>
          </apex:pageBlock>
          </apex:outputPanel>
          
          	First Name: <apex:inputText title="First Name" /><br/>
          	Last Name: <apex:inputText title="Last Name" /><br/>
          	Email Address: <apex:inputText title="Email Address"/>
          
      		</apex:pageBlock>
          </apex:outputPanel>
      
     <apex:dataTable id="cart" value="{!cart}" var="carti" rowClasses="odd,even">
			
   <apex:column headerValue="ID" rendered="false">
       <apex:outputText value="{!cart[carti].merchandise.Id}" >
       </apex:outputText>
          </apex:column>
          <apex:column headerValue="Product">
              <apex:outputText value="{!cart[carti].merchandise.name}">
          	
         </apex:outputText>
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!cart[carti].merchandise.price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:outputText value="{!cart[carti].count}"/>
          </apex:column>
      </apex:dataTable><br/>
      <apex:commandButton action="{!back}" value="Back"/>
    </apex:form>
  
</apex:page>

Debug Log

33.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 09:54:03.024 (24497726)|EXECUTION_STARTED 09:54:03.024 (24542211)|CODE_UNIT_STARTED|[EXTERNAL]|066F0000002RsSW|VF: /apex/ConfirmBuy 09:54:03.025 (25380630)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066F0000002RsSW 09:54:03.034 (34498111)|VF_DESERIALIZE_VIEWSTATE_END 09:54:03.035 (35199520)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(flag) 09:54:03.035 (35216419)|SYSTEM_MODE_ENTER|true 09:54:03.035 (35254184)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|flag 09:54:03.035 (35289756)|METHOD_ENTRY|[1]|01pF0000003wYvo|StoreFront2.StoreFront2() 09:54:03.035 (35301043)|METHOD_EXIT|[1]|StoreFront2 09:54:03.035 (35312888)|CODE_UNIT_FINISHED|flag 09:54:03.035 (35333424)|CODE_UNIT_FINISHED|StoreFront2 get(flag) 09:54:03.035 (35436607)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(ct) 09:54:03.035 (35445196)|SYSTEM_MODE_ENTER|true 09:54:03.035 (35453138)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|ct 09:54:03.035 (35463642)|CODE_UNIT_FINISHED|ct 09:54:03.035 (35477691)|CODE_UNIT_FINISHED|StoreFront2 get(ct) 09:54:03.037 (37951076)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(cart) 09:54:03.037 (37962054)|SYSTEM_MODE_ENTER|true 09:54:03.038 (38429140)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 invoke(getcart) 09:54:03.038 (38510214)|CODE_UNIT_FINISHED|StoreFront2 invoke(getcart) 09:54:03.038 (38527866)|CODE_UNIT_FINISHED|StoreFront2 get(cart) 09:54:03.039 (39136902)|VF_PAGE_MESSAGE|You must enter a value 09:54:03.039 (39194756)|VF_PAGE_MESSAGE|Contact: You must enter a value 09:54:03.041 (41644354)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(flag) 09:54:03.041 (41657898)|SYSTEM_MODE_ENTER|true 09:54:03.041 (41667125)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|flag 09:54:03.041 (41679003)|CODE_UNIT_FINISHED|flag 09:54:03.041 (41694329)|CODE_UNIT_FINISHED|StoreFront2 get(flag) 09:54:03.041 (41855230)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(cart) 09:54:03.041 (41863592)|SYSTEM_MODE_ENTER|true 09:54:03.041 (41872722)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 invoke(getcart) 09:54:03.041 (41907441)|CODE_UNIT_FINISHED|StoreFront2 invoke(getcart) 09:54:03.041 (41923052)|CODE_UNIT_FINISHED|StoreFront2 get(cart) 09:54:03.043 (43145285)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|StoreFront2 get(ct) 09:54:03.043 (43158143)|SYSTEM_MODE_ENTER|true 09:54:03.043 (43166984)|CODE_UNIT_STARTED|[EXTERNAL]|01pF0000003wYvo|ct 09:54:03.043 (43178165)|CODE_UNIT_FINISHED|ct 09:54:03.043 (43193846)|CODE_UNIT_FINISHED|StoreFront2 get(ct) 09:54:03.044 (44246721)|VF_SERIALIZE_VIEWSTATE_BEGIN|066F0000002RsSW 09:54:03.059 (59665759)|VF_SERIALIZE_VIEWSTATE_END 09:54:03.063 (63844095)|CODE_UNIT_STARTED|[EXTERNAL]|Generate Metadata 09:54:03.064 (64937778)|CODE_UNIT_FINISHED|Generate Metadata 09:54:03.068 (68974239)|CUMULATIVE_LIMIT_USAGE 09:54:03.068 (68974239)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 09:54:03.068 (68974239)|CUMULATIVE_LIMIT_USAGE_END 09:54:03.069 (69016245)|CODE_UNIT_FINISHED|VF: /apex/ConfirmBuy 09:54:03.070 (70286691)|EXECUTION_FINISHED