Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page controller="AddmultipleAccountController">
- <apex:form>
- <apex:pageBlock>
- <apex:pageBlockTable="{!ListAccount}" var="a" >
- <apex:inputField value="{!a.name}"/>
- <apex:inputField value="{!a.AccountNumber}"/>
- <apex:inputField value="{!a.Type}"/>
- <apex:inputField value="{!a.Industry}"/>
- </apex:pageBlockTable>
- <apex:pageBlockButtons>
- <apex:commandButton value="Add Accounts Row" action="{!addAccount}"/>
- <apex:commandButton value="Save Accounts" action="{!saveAccount}"/>
- </apex:pageBlockButtons>
- </apex:pageBlock>
- </apex:form>
- </apex:page
- public class AddmultipleAccountController {
- public List<Account> ListAccount{get; set;}
- public AddmultipleAccountController(ApexPages.StandardController myController)
- {
- ListAccount = new List<Account>();
- Account acc= new Account();
- ListAccount.add(acc);
- }
- public void addAccount()
- {
- Account acc= new Account();
- ListAccount.add(acc);
- }
- public PageReference saveAccount()
- {
- for(integer i=0; i<ListAccount.size(); i++)
- {
- insert ListAccount;
- }
- return Page.AllAccountssaved;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement