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
uHaveOptionsuHaveOptions 

Save Button in Visualforce Page Issue

I have this Save Button code.

<apex:pageBlockButtons >
        <apex:commandLink value="Save" action="{!save}" id="savebutton" styleClass="btn" style="text-decoration:none;padding:4px;"></apex:commandlink>
        </apex:pageBlockButtons>

I have a lot of issues and bugs on "Saving" data in my visualforce page.  And was wondering if you guys can shed some light on how to fix it.  It's been bugging me and becoming a show stopper in my development.

Problems when pressing "Save"
Problem 1 - If I enter data in a text field and press "Save", it reloads but doesnt save the data.  But when I enter data in a text field AND click out and save... it saves it.  I cant have that.  I'm getting complaints on that.  Especially when they keep entering data then just presses save and it doesnt save the last data get really annoying.  

Problem 2 - when putting Target="_self" it saves it inside that iFrame.  If I do Target="_parent" it saves it but just showing the VF Page and I lose my headers, search, etc...  I just want to press save and stay in the SAME tab.  Instead, it reloads in the first tab and you get more mad when you click on the tab you want and the data doesnt save.

I just want to save the data and refresh in the same tab.  Thats all I need.  Please help 

Mahesh DMahesh D
Hi Jon,

Problem 1: 

For inputField tag value is required and it will automatically bind into that object's field.
For inputText tag value is not required and it may not bind into the object's field.

Problem 2:

To return to the same page, you can reset the object and return null from the save method.

If you are expecting more detailed explanation, please paste your VF and controller here and can explain in more detailed.

Please do let me know if it helps you.

Regards,
Mahesh

 
salesforce mesalesforce me
Hi jon check this once..
 
<apex:page controller="NewAndExistingController" tabstyle="Account">
    <apex:form>
        <apex:pageBlock mode="edit">
            <apex:pageMessages/>
            <apex:pageBlockSection>
                <apex:inputField value="{!Account.name}"/>
                <apex:inputField value="{!Account.phone}"/>
                <apex:inputField value="{!Account.industry}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
public class NewAndExistingController {

    public Account account { get; private set; }

    public NewAndExistingController() {
        Id id = ApexPages.currentPage().getParameters().get('id');
        account = (id == null) ? new Account() : 
            [SELECT Name, Phone, Industry FROM Account WHERE Id = :id];
    }

    public PageReference save() {
        try {
            upsert(account);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        //  After successful Save, navigate to the default view page
        PageReference redirectSuccess = new ApexPages.StandardController(Account).view();
        return (redirectSuccess);
    }
}


 
JyothsnaJyothsna (Salesforce Developers) 
Hi Jon,

Please check the below sample code.

Visualforce Page
<apex:page standardController="lead" extensions="leds" showHeader="false">
  <apex:form >
  <apex:pageBlock >
  <apex:pageBlockSection >
  <apex:inputField value="{!lead.Lastname}"/>
  <apex:inputField value="{!lead.Email}"/>
  <apex:inputField value="{!lead.company}"/>
  </apex:pageBlockSection>
  <apex:pageBlockButtons location="bottom">
 <apex:commandButton value="save" action="{!save}"/>
  </apex:pageBlockButtons>
  </apex:pageBlock>
  </apex:form>
  </apex:page>

Controller
 
public with sharing class leds {
public lead s;
public leds(){}
    public leds(ApexPages.StandardController controller) {
  s = (lead)Controller.getRecord();
    }
public pagereference  save(){
   
   
            insert s;
        
        
          
          PageReference pr=new PageReference(('https://ap1.salesforce.com/'+s.Id));
      return pr;
  
}
}

Hope this helps you!
Best Regards,
Jyothsna
uHaveOptionsuHaveOptions

I got problem 1 solved.  Using this code... <apex:commandButton value="save" action="{!save}"/>

I'm stuck on problem 2.  When I use rerender, it renders but doesnt save...  I updated the <apex:form id="PropertyTab4"> and added <apex:commandButton action="{!Save}" value="Save" rerender="PropertyTab4"/>

it renders but doesnt save

 

<apex:tab label="Loan Information" name="name4" id="Property4">
<apex:form id="PropertyTab4"> 
         <apex:pageBlock >
  <apex:pageblocksection > 
      <apex:outputText style="font-size:20px;text-align:left;color:{!IF(Property__c.Sales_Status__c = 'Proposal', 'red', '#081f3f')};" value="{0} | {1}">
       <apex:param value="{!Property__c.Name}"/>
       <apex:param value="{!Property__c.Sales_Status__c}"/>
      </apex:outputText>
 <!-- <apex:commandButton action="{!save}" id="saveButton" value="Save" style="float:center"/> -->

  </apex:pageblocksection>

        <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save" rerender="PropertyTab4"/>
        </apex:pageBlockButtons> 
        
           <apex:pageBlockSection columns="2">
           <apex:inlineEditSupport event="ondblClick"/>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Tenant" for="Property__c.tenant__c" style="font-weight:bold"/>
                         <a href="/{!Property__c.Tenant__r.id}" target="_blank">{!Property__c.Tenant__r.name}</a>    
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Anniversary Date" for="Property__c.Loan_Maturity_Date__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Loan_Maturity_Date__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Amount/Month" for="Property__c.Close_Date_Anniversery__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Close_Date_Anniversery__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Send Lease Anniversary" for="Property__c.Send_Lease_Anniversary__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Send_Lease_Anniversary__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Amount/Year" for="Property__c.Amount_Year__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Amount_Year__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Type" for="Property__c.Lease_Type__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lease_Type__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Date Lease Entered" for="Property__c.Date_Lease_Entered__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Date_Lease_Entered__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Expiration Date" for="Property__c.Lease_Expiration_Date__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lease_Expiration_Date__c}" id="Property4"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Years Remaining" for="Property__c.Years_Remaining__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Years_Remaining__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Commencement Date" for="Property__c.Lease_Commencement_Date__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lease_Commencement_Date__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Tenant Sales" for="Property__c.Tenant_Sales__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Tenant_Sales__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Rent Commencement Date" for="Property__c.Rent_Commencement_Date__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Rent_Commencement_Date__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="$/SF/Month" for="Property__c.SF_Month__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.SF_Month__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Rental Rate/Annual" for="Property__c.Rental_Rate_Annual__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Rental_Rate_Annual__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="$/SF/Year" for="Property__c.SF_Year__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.SF_Year__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Original Lease Term" for="Property__c.Original_Lease_Term__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Original_Lease_Term__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Created By" for="Property__c.Lease_Created_By__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lease_Created_By__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>     
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Options" for="Property__c.Options__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Options__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lease Notes" for="Property__c.Lease_Notes__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lease_Notes__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="OSF ID" for="Property__c.OSF_ID__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.OSF_ID__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Term Remaining on Lease" for="Property__c.Term_Remaining_on_Lease__c" onkeypress="return noenter(event)" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Term_Remaining_on_Lease__c}" id="Property4"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>
         
       </apex:tab>
    </apex:tabPanel>
</apex:page>
This is the bottom page.  Thanks in advance
Mahesh DMahesh D
Hi Jon,

In the save() method you can redirect to the same page after completion of your save operation.
 
public PageReference save() {
        //-----Your save operations.
        PageReference page = new PageReference( '/apex/UrVFPage');
        page.setRedirect(true);
        
        return page;
}

Please do let me know if it helps you.

Regards,
Mahesh
uHaveOptionsuHaveOptions
which line do I insert that?
uHaveOptionsuHaveOptions
I guess I have to insert that in the extension?
Mahesh DMahesh D
Please paste your Controller, so that I can explain you better.

Also paste first line of your VF page.

Regards,
Mahesh
uHaveOptionsuHaveOptions

Current Extension
 
public class ProposalExtensionController{
    Proposal__c proposal;
    
    public ProposalExtensionController(ApexPages.StandardController controller)
    {
        proposal = (proposal__c)controller.getRecord();
    }
    
    public PageReference save()
    {
        update proposal;
        return null;
    }
}
VF Page
 
<apex:page standardController="Property__c" showHeader="false" sidebar="false" extensions="PropertyExtensionController">
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #081f3f; color:white; background-image:none;}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none;}
    .name{font-size:20px;text-align:left;}
    .status{color:pink;}
    </style>

    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="Property__c" id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="Property Information" name="name1" id="Property">
         <apex:form >
<apex:pageBlock >
  <apex:pageblocksection > 

    <apex:outputText style="font-size:20px;text-align:left;color:{!IF((Property__c.Sales_Status__c = 'Proposal'||Property__c.Sales_Status__c = 'Listing'||Property__c.Sales_Status__c = 'Escrow'||Property__c.Sales_Status__c = 'Sales Comp')&&(Property__c.Expired__c=false), 'red', IF((Property__c.Sales_Status__c = 'Proposal')&&(Property__c.Expired__c=true), 'blue', '#081f3f'))};" value="{0} | {1}"> 
<apex:param value="{!Property__c.Name}"/>
<apex:param value="{!Property__c.Sales_Status__c}" />
     
</apex:outputText>
<!--<apex:commandButton action="{!save}" id="saveButton" value="Save" style="float:center"/> -->
  </apex:pageblocksection>
          <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save"/>
        </apex:pageBlockButtons> 
           <apex:pageBlockSection columns="2">
           <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Property Type" for="Property__c.Retail_Type__c" />
                    <apex:inputField value="{!Property__c.Retail_Type__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Sale Status" for="Property__c.Sales_status__c" onkeypress="return noenter(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Sales_Status__c}" id="Property" styleclass="Property" />     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Property Sub-Type" for="Property__c.Tenant_Sub_Type__c" />
                    <apex:inputField value="{!Property__c.Tenant_Sub_Type__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Ownership Entity" for="Property__c.Ownership_Entity__c" onkeypress="return noenter(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Ownership_Entity__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem > 
                </apex:pageBlockSectionItem>
                    
                <apex:pageBlockSectionItem >                
                    <apex:outputLabel value="Primary Contact" for="Property__c.Primary_Contact__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <a href="/{!Property__c.Primary_Contact__c}" target="_blank">{!Property__c.Primary_Contact__r.name}</a>
                </apex:pageBlockSectionItem>
                
                                <apex:pageBlockSectionItem > 
                </apex:pageBlockSectionItem>
                
                        <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Contact Company" for="Property__c.Primary_Contact_Company__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Contact_Company__c}" id="Property"/>
</apex:pageBlockSectionItem>       
                <apex:pageBlockSectionItem > 
                </apex:pageBlockSectionItem>

                        <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Contact Parent Company" for="Property__c.Primary_Contact_Parent_Company__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Contact_Parent_Company__c}" id="Property"/>
</apex:pageBlockSectionItem>         
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Address" for="Property__c.Property_Address__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Property_Address__c}" id="Property"/>
</apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Contact Phone" for="Property__c.Primary_Contact_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Contact_Phone__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="City" for="Property__c.City__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.City__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Work Phone" for="Property__c.Primary_Work_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Work_Phone__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="State" for="Property__c.state__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.State__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                
<apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Mobile" for="Property__c.Primary_Mobile__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Mobile__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Zip Code" for="Property__c.Zip_Postal_Code__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Zip_Postal_Code__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                
                                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Direct Number" for="Property__c.   Primary_Direct_Number__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Direct_Number__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem > 
                </apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Home Phone" for="Property__c.Primary_Home_Phone__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Home_Phone__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem > 
                </apex:pageBlockSectionItem>
                
                                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Primary Contact Email" for="Property__c.Primary_Contact_Email__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Primary_Contact_Email__c}" id="Property"/>     
                </apex:pageBlockSectionItem>                
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>                
<apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Last Call Date" for="Property__c.Last_Call_Date__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Last_Call_Date__c}" id="Property"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Property Mailer Name" for="Property__c.Property_MAILER_Name__c" onkeypress="return onKeyup_TxtFieldcom(event);" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Property_MAILER_Name__c}" id="Property"/>     
                </apex:pageBlockSectionItem>     
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>

           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>


       </apex:tab>
   

        
        
        <apex:tab label="Building Information" name="name2" id="Property2">
<apex:form > 
         <apex:pageBlock >
  <apex:pageblocksection > 
      <apex:outputText style="font-size:20px;text-align:left;color:{!IF(Property__c.Sales_Status__c = 'Proposal', 'red', '#081f3f')};" value="{0} | {1}">
       <apex:param value="{!Property__c.Name}"/>
       <apex:param value="{!Property__c.Sales_Status__c}"/>
      </apex:outputText>
 <!-- <apex:commandButton action="{!save}" id="saveButton" value="Save" style="float:center"/> -->

  </apex:pageblocksection>
          <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save"/>
        </apex:pageBlockButtons> 
           <apex:pageBlockSection columns="2">
           <apex:inlineEditSupport event="ondblClick"/>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Anchor GLA" for="Property__c.Anchor_GLA__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Anchor_GLA__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Number of Buildings" for="Property__c.Number_of_Buildings__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Number_of_Buildings__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Anchor Tenants" for="Property__c.Anchor_Tenants__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Anchor_Tenants__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Number of Retail Units" for="Property__c.Type__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Type__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Lot Size" for="Property__c.Lot_Size__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Lot_Size__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Year Renovated" for="Property__c.Year_Renovated__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Year_Renovated__c}" id="Property2"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Zoning" for="Property__c.Zoning__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Zoning__c}" id="Property2"/>     
                </apex:pageBlockSectionItem> 
           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>
       </apex:tab>
       
        <apex:tab label="Financial Information" name="name3" id="Property3">
        <apex:form > 
         <apex:pageBlock >
  <apex:pageblocksection > 
      <apex:outputText style="font-size:20px;text-align:left;color:{!IF(Property__c.Sales_Status__c = 'Proposal', 'red', '#081f3f')};" value="{0} | {1}">
       <apex:param value="{!Property__c.Name}"/>
       <apex:param value="{!Property__c.Sales_Status__c}"/>
      </apex:outputText>
 <!-- <apex:commandButton action="{!save}" id="saveButton" value="Save" style="float:center"/> -->

  </apex:pageblocksection>
          <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save"/>
        </apex:pageBlockButtons> 
         
           <apex:pageBlockSection columns="2">
           <apex:inlineEditSupport event="ondblClick"/>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Loan Amortization" for="Property__c.Loan_Amortization__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Loan_Amortization__c}" id="Property3"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Term Remaining on Lease" for="Property__c.Term_Remaining_on_Lease__c" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Term_Remaining_on_Lease__c}" id="Property3"/>     
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>
       </apex:tab>


        <apex:tab label="Loan Information" name="name4" id="Property4">
<apex:form id="PropertyTab4"> 
         <apex:pageBlock >
  <apex:pageblocksection > 
      <apex:outputText style="font-size:20px;text-align:left;color:{!IF(Property__c.Sales_Status__c = 'Proposal', 'red', '#081f3f')};" value="{0} | {1}">
       <apex:param value="{!Property__c.Name}"/>
       <apex:param value="{!Property__c.Sales_Status__c}"/>
      </apex:outputText>
 <!-- <apex:commandButton action="{!save}" id="saveButton" value="Save" style="float:center"/> -->

  </apex:pageblocksection>

        <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save" rerender="PropertyTab4"/>
        </apex:pageBlockButtons> 
        
           <apex:pageBlockSection columns="2">
           <apex:inlineEditSupport event="ondblClick"/>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>
         
       </apex:tab>
    </apex:tabPanel>
</apex:page>
Where should I paste them?
uHaveOptionsuHaveOptions
Update...  Sorry I put the wrong controller...
 
public class PropertyExtensionController{
    Property__c property;
    
    public PropertyExtensionController(ApexPages.StandardController controller)
    {
        property = (Property__c)controller.getRecord();
    }
    
    public PageReference save()
    {
        update property;
        return null;
    }
}

 
Mahesh DMahesh D
Hi Jon,

Please find the below code:
 
public class PropertyExtensionController{
    Property__c property;
    
    public PropertyExtensionController(ApexPages.StandardController controller)
    {
        property = (Property__c)controller.getRecord();
    }
    
    public PageReference save()
    {
        update property;
        PageReference page = new PageReference( '/apex/UrVFPage?Id='+property.Id);
        page.setRedirect(true);
        
        return page;
    }
}

Here replace "UrVFPage" this with your VF Page Name.

Please do let me know if it helps you.

Regards,
Mahesh
uHaveOptionsuHaveOptions
That didnt work.  It reloaded back to the first tab.  It didnt reload to the tab I was working on.
uHaveOptionsuHaveOptions

This was my controller

public class PropertyExtensionController{
    Property__c property;
    
    public PropertyExtensionController(ApexPages.StandardController controller)
    {
        property = (Property__c)controller.getRecord();
    }
    
    public PageReference save()
    {
        update property;
        PageReference page = new PageReference( '/apex/PropertyTestTabs?Id='+property.Id);
        page.setRedirect(true);
        
        return page;
    }
}
Mahesh DMahesh D
Hi Jon,

Then better to use the old code for save() method.

Onething I identified here is, in the VF page you shouldn't use 

Property__c.                   --- This is the object name

it should be

property.                        ----  This is the member variable in your controller.

Always use the member variable and your second problem of saving will be resolved.

Take a backup of your current VF page and replace and replace Property__c with property in the whole VF page.

Please do let me know if it helps you.

Regards,
Mahesh

 
uHaveOptionsuHaveOptions
That didnt work also.  It gave me an object error.  Let me try to figure it out.
uHaveOptionsuHaveOptions
This is weird....  Solution 1 works on Custom Objects but not STANDARD Objects.  any reason why?
Mahesh DMahesh D
Hi Jon,

Here you also need to change the Constructor, I am not sure whether you changed it or not.
 
public PropertyExtensionController(ApexPages.StandardController controller)  {
        property = (Property__c)controller.getRecord();
        property = [Select Id, Name,........... from Property__c where Id =: property.Id];
 }

Please paste the latest after this modification along with actual error message.

Regards,
Mahesh