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
sarvesh001sarvesh001 

refresh the form

Hi,
I want to refresh the form after click the Save button . There is method called in save button then i want to refresh th form.


Can any one help me out for this........




Thanks,
sarvesh.
Cloud_forceCloud_force
you can use rerender for refreshing particular section of page in case you are looking for soemthing similar..

thanks,
http://www.forcexplore.com/2014/01/salesforce-interview-question-1.html
Abhishek_PareekAbhishek_Pareek
I believe this is what you're looking for:
public with sharing class SampleRerenderController{
	public string nonRerenderedvalue{get;set;}
	public string rerenderedvalue{get;set;}
	
	public SampleRerenderController(){
		nonRerenderedvalue = 'initial value';
		rerenderedvalue = 'initial value1';
	}

	public PageReference save(){
		rerenderedvalue = 'updated value1';
		//write your business logic here
		return null;
	}
}
and this is the sample page
<apex:page controller="SampleRerenderController">
<apex:outputPanel>{!nonRerenderedvalue}</apex:outputPanel>
<apex:form id="theForm">
	<apex:outputPanel>{!rerenderedvalue}</apex:outputPanel>
	<apex:commandButton value="Save" action="{!save}" reRender="theForm"/>
    </apex:form>
</apex:page>

Hope this helps.
sarvesh001sarvesh001
Hi   Abhishek_Pareek,
I have posted the code , i heve replicate the same but form is not rerendered here.\


<apex:form id="theForm" >

<apex:pageBlock id="membAdd"   > 
                   
         
            <apex:pageBlockTable id="pagetable1" border="1"  style="width:80%; height:50px;"   value="{!memberList  }" var="memb" >
              <apex:column headerValue="Action" style="  width:100px;">
            <apex:outputLink title="" value="/{!memb.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold; width:80px;">Edit</apex:outputLink>&nbsp;|&nbsp;
            <a href="javascript:if (window.confirm('Are you sure?')) DeleteAccount('{!memb.Id}');" style="font-weight:bold">Del</a>
            </apex:column>
                <apex:column headerValue="Power (MW)">
                    <apex:outputField style="  width:80px;" value="{!memb.Power_MW__c}"/>
                </apex:column>
                <apex:column headerValue="Quatity">
                    <apex:outputField style="  width:90px;" value="{!memb.Qty__c}"/>
                </apex:column>
                <apex:column headerValue="Turbine Type">
                    <apex:outputField style="  width:110px;" value="{!memb.Turbine_Type__c}"/>
                </apex:column>
                <apex:column headerValue="Condenser">
                    <apex:outputField style="  width:80px;" value="{!memb.Condensor__c}"/>
                </apex:column>
                <apex:column headerValue="Exhaust Pressure(ata)">
                    <apex:outputField style="  width:120px;" value="{!memb.Exhaust_Pressure_ata__c}"/>
                </apex:column>
                <apex:column headerValue="Frame Offered">
                    <apex:outputField style="  width:80px;" value="{!memb.Frame_Offered__c}"/>
                </apex:column>
                <apex:column headerValue="Inlet Pressure(ata)">
                    <apex:outputField style="  width:100px;" value="{!memb.Inlet_Pressure_ata__c}"/>
                </apex:column>
                <apex:column headerValue="Inlet Temp(℃)">
                    <apex:outputField style="  width:80px;" value="{!memb.Inlet_Temp__c}"/>
                </apex:column>
                 <apex:column headerValue="Rating MW">
                    <apex:outputField style="  width:80px;" value="{!memb.Rating_MW__c}"/>
                </apex:column>
                <apex:column headerValue="Extraction Pressure">
                    <apex:outputField style="  width:70px;" value="{!memb.Extraction_Pressure__c}"/>
                </apex:column>
            </apex:pageBlockTable>
           
       <apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="membAdd" >
       <apex:param name="accountid" value="" assignTo="{!SelectedAccountId}"/>
       </apex:actionFunction>
                  
             <br/><br/><br/>
            <apex:pageBlockTable border="1" style="width:70%"   value="{!memberAddList}" var="memb" >
           
                <apex:column headerValue="Power (MW)">
                    <apex:inputField style="  width:80px;" value="{!memb.Power_MW__c}"/>
                </apex:column>
                <apex:column headerValue="Quatity">
                    <apex:inputField style="  width:80px;" value="{!memb.Qty__c}"/>
                </apex:column>
                <apex:column headerValue="Turbine Type">
                    <apex:inputField style="  width:110px;" value="{!memb.Turbine_Type__c}"/>
                </apex:column>
                <apex:column headerValue="Condenser">
                    <apex:inputField style="  width:80px;" value="{!memb.Condensor__c}"/>
                </apex:column>
                <apex:column headerValue="Exhaust Pressure(ata)">
                    <apex:inputField style="  width:120px;" value="{!memb.Exhaust_Pressure_ata__c}"/>
                </apex:column>
                <apex:column headerValue="Frame Offered">
                    <apex:inputField style="  width:80px;" value="{!memb.Frame_Offered__c}"/>
                </apex:column>
                <apex:column headerValue="Inlet Pressure(ata)">
                    <apex:inputField style="  width:100px;" value="{!memb.Inlet_Pressure_ata__c}"/>
                </apex:column>
                <apex:column headerValue="Inlet Temp(℃)">
                    <apex:inputField style="  width:80px;" value="{!memb.Inlet_Temp__c}"/>
                </apex:column>
                 <apex:column headerValue="Rating MW">
                    <apex:inputField style="  width:80px;" value="{!memb.Rating_MW__c}"/>
                </apex:column>
                <apex:column headerValue="Extraction Pressure">
                    <apex:inputField style="  width:110px;" value="{!memb.Extraction_Pressure__c}"/>
                </apex:column>
            </apex:pageBlockTable>
      
            <br/><apex:commandLink style="font-weight:bold;font-size:10pt;  " value="Add Row" action="{!addRow}" reRender="membAdd"/>       
           &nbsp;  &nbsp;  &nbsp;
           <apex:pageblockSection columns="1" >
                <apex:pageblockSectionItem >
                </apex:pageblockSectionItem>        
          </apex:pageblockSection>
          <apex:commandButton style="font-weight:bold; margin-left:400px; width:80px;" value="Save" action="{!savedata}" reRender="theForm" />
           <apex:commandButton value="Save" action="{!savedata}" reRender="theForm"/>
       </apex:pageBlock>
            
</apex:form>



controller-------------------
public class Turbines {
public List<Turbines__c> delattendeeList {get;set;}
public Integer rowIndex {get;set;}
public Turbines__c del;
public string SelectedAccountId { get; set; }
  

public List<Turbines__c> memberList {get;set;}
    public List<Turbines__c> memberAddList {get;set;}
    public String memberName {get;set;}  
   
    public Turbines(ApexPages.StandardController controller) {
    LoadData();
    }
    public void LoadData(){
    String Tid= ApexPages.currentPage().getParameters().get('id');
    system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+Tid);
   
      // String sql = 'SELECT Name,Bleed_1_kg_cm2__c,Possibility_for_TTL__c ,Bleed_3_kg_cm2__c ,Status_of_turbine__c ,Extraction_Pressure__c ,Bleed_2_kg_cm2__c  ,Power_MW__c,Lead__c,Speed__c ,Molecular_Weight__c ,No_of_Turbine__c ,Opportunity__c,Parameters__c ,Qty__c,Turbine_Type__c,Condensor__c,Exhaust_Pressure_ata__c,Frame_Offered__c,Inlet_Pressure_ata__c,Inlet_Temp__c FROM Turbines__c where Lead__c=:Tid ';
        memberList = new List<Turbines__c>();
       // memberList = Database.Query(sql);
       memberList =[SELECT Name,Bleed_1_kg_cm2__c,Possibility_for_TTL__c ,Rating_MW__c,Bleed_3_kg_cm2__c ,Status_of_turbine__c ,Extraction_Pressure__c ,Bleed_2_kg_cm2__c  ,Power_MW__c,Lead__c,Speed__c ,Molecular_Weight__c ,No_of_Turbine__c ,Opportunity__c,Parameters__c ,Qty__c,Turbine_Type__c,Condensor__c,Exhaust_Pressure_ata__c,Frame_Offered__c,Inlet_Pressure_ata__c,Inlet_Temp__c FROM Turbines__c where Lead__c =: Tid ];
      
         system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+memberList );
        
        memberAddList = new List<Turbines__c>();
       
        memberAddList.add(new Turbines__c(Lead__c=Tid));
    
    }
    public pageReference savedata(){
   
       upsert memberAddList;
      
    
      
      
      
       system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@savedaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
       return null ;
        
    }

     public void AddRow()
    {
        memberAddList.add(new Turbines__c( ));
    } 
    public void deleteRow()
    {}
    public void DeleteAccount()
   {
      // if for any reason we are missing the reference
      if (SelectedAccountId == null) {
     
         return;
      }
    
      // find the account record within the collection
      Turbines__c tobeDeleted = null;
      for(Turbines__c a : memberList )
       if (a.Id == SelectedAccountId) {
          tobeDeleted = a;
          break;
       }
     
      //if account record found delete it
      if (tobeDeleted != null) {
       Delete tobeDeleted;
      }
    
      //refresh the data
      LoadData();
   }   
     
     

}