You need to sign in to do that
Don't have an account?
Alessandro Guarnieri 4
Add an action using Standard List Controller
Hi,
I'm trying to add the save action to a button on a visualforce page to save a new account. I'm using a standard list controller because I want the page to be available as a list button. If I click on save it doesn't work, am I missing something?
Thanks
Here is the code:
I'm trying to add the save action to a button on a visualforce page to save a new account. I'm using a standard list controller because I want the page to be available as a list button. If I click on save it doesn't work, am I missing something?
Thanks
Here is the code:
<apex:page standardController="Account" recordSetVar="accounts"> <apex:form> <apex:pageBlock> <apex:pageBlockSection> <apex:pageBlockSectionItem > <apex:outputLabel >Account Name</apex:outputLabel> <apex:inputField id="actName" value="{!account.name}"/> </apex:pageBlockSectionItem> <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
thanks for the reply, unfortunately it doesn't really work if I add <apex:pageBlockButtons> </apex:pageBlockButtons>. Do you have any other suggestions?
Thanks,
Alessandro
Thanks
thanks,
Alessandro
Pleace check the below code,I think it will works for u
<apex:page standardController="Account" recordSetVar="accounts">
<apex:form >
<apex:pageblock >
<apex:pageBlockTable value="{!accounts}" var="acc">
<apex:column headerValue="Name">
<apex:inputField value="{!acc.name}"/>
</apex:column>
<!-- <apex:column headerValue="Name">
<apex:commandButton value="Save" action="{!save}"/>
</apex:column> -->
</apex:pageBlockTable>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageblock>
</apex:form>
</apex:page>
Thanks,
Raghavendra Reddy.D
my goal would be to have a visualforce page which I can use on a custom list button to override the new button and to create a new account, so this solution doesn't really fit unfortunately. It would be nice then to write a method on a controller extension which saves the new account, since the save action of the standard list controller doesn't work in my case.
Alessandro
public class recordsetvarsavecon {
Public Account accobj{get;set;}
public recordsetvarsavecon(ApexPages.StandardSetController controller) {
accobj= new Account();
}
Public void save(){
Account acc=new Account();
acc.Name=accobj.Name;
insert acc;
}
}
<apex:page standardController="Account" extensions="recordsetvarsavecon" recordSetVar="accounts">
<apex:form >
<apex:pageblock >
<apex:inputField value="{!accobj.name}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageblock>
</apex:form>
</apex:page>
Thanks,
Raghavendra Reddy