+ Start a Discussion
Vidya RaniVidya Rani 

"Save" not working on Standard list using Inline Edit

I am trying to display list of Accounts using Standard controller and allow inline edit of records displayed. The Save button I have added is not working/saving the udpate in database. Can someone please help, what m I missing
Do I need to write extension for this?

Code piece:
<apex:page standardController="Account" recordSetVar="Account">  <!-- extensions="myControllerExtension"> -->
    <apex:form >
    <apex:pageBlock title="Account Summary" mode="inlineEdit">
    <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
                        hideOnEdit="editButton" event="ondblclick" 
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                        
                <apex:commandButton action="{!quicksave}" id="saveButton" value="Save" rendered="true"/>
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel" rendered="true"/>
  <apex:pageBlockTable value="{! Account}" var="at">
            <apex:column value="{! at.Name }"/>
            <apex:column value="{! at.Phone}"/>
            <apex:column value="{! at.Industry}"/>
            <apex:column value="{! at.AnnualRevenue }"/>
            <apex:column value="{! at.Id }"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
     </apex:form>
</apex:page>
Best Answer chosen by Vidya Rani
Narender Singh(Nads)Narender Singh(Nads)
Hi,

Use this code in your pageblocktable:
<apex:pageBlockTable value="{! Account}" var="at">
            
      		<apex:column headerValue="Name" >
                    <apex:outputField value="{! at.Name}" />
      		</apex:column>
      		<apex:column headerValue="Phone" >
                     <apex:outputField value="{! at.Phone}" />
      		</apex:column>
                <apex:column headerValue="Industry" >
                   <apex:outputField value="{! at.Industry}" />
      		</apex:column>
      		<apex:column headerValue="AnnualRevenue" >
                   <apex:outputField value="{! at.AnnualRevenue}" />
      		</apex:column>
                <apex:column headerValue="Account ID" >
                   <apex:outputField value="{! at.Id}" />
      		</apex:column>
</apex:pageBlockTable>

 

All Answers

Narender Singh(Nads)Narender Singh(Nads)
Hi,

Use this code in your pageblocktable:
<apex:pageBlockTable value="{! Account}" var="at">
            
      		<apex:column headerValue="Name" >
                    <apex:outputField value="{! at.Name}" />
      		</apex:column>
      		<apex:column headerValue="Phone" >
                     <apex:outputField value="{! at.Phone}" />
      		</apex:column>
                <apex:column headerValue="Industry" >
                   <apex:outputField value="{! at.Industry}" />
      		</apex:column>
      		<apex:column headerValue="AnnualRevenue" >
                   <apex:outputField value="{! at.AnnualRevenue}" />
      		</apex:column>
                <apex:column headerValue="Account ID" >
                   <apex:outputField value="{! at.Id}" />
      		</apex:column>
</apex:pageBlockTable>

 
This was selected as the best answer
SandhyaSandhya (Salesforce Developers) 
Hi,

You can List Controller for the same.Refer below sample code for opportunities.
 
<apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity" sidebar="false">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!opportunities}" var="opp">
                <apex:column value="{!opp.name}"/>
                <apex:column headerValue="Stage">
                    <apex:inputField value="{!opp.stageName}"/>
                </apex:column>
                <apex:column headerValue="Close Date">
                    <apex:inputField value="{!opp.closeDate}"/>
                </apex:column>
            </apex:pageBlockTable>      
        </apex:pageBlock>
    </apex:form>
</apex:page>

If you want to use custom controller then refer below link which has sample code.

https://www.linkedin.com/pulse/how-do-inline-edit-custom-visualforce-page-ravi-kant

Please mark it as Solved if my reply was helpful. It will make it available for other as the proper solution.
 
Thanks and Regards
Sandhya
 
Vidya RaniVidya Rani
@Narendra- Thanks ,it worked.
Ajay K DubediAjay K Dubedi
Hi Vidya,

This code edit and save successfully and check updated account in referring.
Please check below code I hope you understand this.

<apex:page standardController="Account" recordSetVar="records" id="thePage" tabStyle="Account"> 
    <apex:form id="theForm"> 
        <apex:pageBlock id="thePageBlock" title="Account Summary"  mode="inlineEdit"> 
            <apex:pageBlockTable value="{!records}" var="at" id="thePageBlockTable"> 
                <apex:column >
                    <apex:outputField value="{!at.Name}"/> 
                    <apex:facet name="header">Name</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:outputField value="{!at.Phone}"/> 
                    <apex:facet name="header">Phone</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:outputField value="{!at.Industry}"/>  
                        <apex:facet name="header">Industry</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:outputField value="{!at.AnnualRevenue}"/>  
                        <apex:facet name="header">Annual Revenue</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:outputField value="{!at.Id}"/>  
                        <apex:facet name="header">AccountId</apex:facet>
                </apex:column>
                <apex:inlineEditSupport event="ondblClick" 
                        showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" /> 
            </apex:pageBlockTable> 
            <apex:pageBlockButtons > 
                <apex:commandButton value="Edit" action="{!save}" id="editButton" />
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
            </apex:pageBlockButtons> 
        </apex:pageBlock> 
    </apex:form>
</apex:page>


Thank You
Ajay Dubedi