You need to sign in to do that
Don't have an account?
Vf page is not updating account
i am new to visualforce i created a page with customController that shows list of account and i want to update account field within the list below is my code ,so any one please let me know where is the mistake
its not updating field
public class CustomController {
list<account> acts;
public list<account> getacts(){
acts=new list<account>();
acts=[select name,rating,industry,type from account where rating!=null AND type!=null limit 20];
return acts;
}
public pageReference save(){
update acts;
return null;
}
}
<apex:page Controller="CustomController">
<apex:form >
<apex:pageBlock title="Account Display">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageBlockSection >
<apex:pageBlockTable value="{!acts}" var="c">
<apex:column value="{!c.name}"/>
<apex:column value="{!c.rating}"/>
<apex:column value="{!c.Industry}"/>
<apex:column value="{!c.type}"/>
</apex:pageBlockTable>
<apex:inlineEditSupport />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thank You
its not updating field
public class CustomController {
list<account> acts;
public list<account> getacts(){
acts=new list<account>();
acts=[select name,rating,industry,type from account where rating!=null AND type!=null limit 20];
return acts;
}
public pageReference save(){
update acts;
return null;
}
}
<apex:page Controller="CustomController">
<apex:form >
<apex:pageBlock title="Account Display">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageBlockSection >
<apex:pageBlockTable value="{!acts}" var="c">
<apex:column value="{!c.name}"/>
<apex:column value="{!c.rating}"/>
<apex:column value="{!c.Industry}"/>
<apex:column value="{!c.type}"/>
</apex:pageBlockTable>
<apex:inlineEditSupport />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thank You
>> https://developer.salesforce.com/forums/?id=9060G0000005eLUQAY
The above link has an implementation to update an account record via visualforce page, below is the controller class that is mentioned you can modify it to fit your need.
Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.
Thanks.