You need to sign in to do that
Don't have an account?

Row is automatically being added to the table when inserting a record
Hi,
I have created a visualforce page, In that i have created a table which has 16 columns and 1 row whose values are all dropdowns. Now after i select the values from the dropdowns and save the record, each time another row with all the dropdowns are being inserted into the table where i am inserting the values. I want only 1 row for the table.
Can anyone please help me out.
Thanks,
prasuna
Hi..
I have modified TehNrd code here..
Sample code:
Controller Code: public class multiAccountInsert { public List<Account> accts {get; set;} public multiAccountInsert() { accts = new List<Account>(); accts.add(new Account()); } public void save() { insert accts; accts.clear(); accts.add(new Account()); } public PageReference save_close() { insert accts; PageReference home = new PageReference('/home/home.jsp'); home.setRedirect(true); return home; } } Page Code <apex:page controller="multiAccountInsert"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons> <apex:commandButton value="Save and Close" action="{!save_close}" rerender="error"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!accts}" var="a" id="table"> <apex:facet name="footer"> <apex:commandLink value="Save" action="{!save}" rerender="table,error"/> </apex:facet> <apex:column headerValue="Name"> <apex:inputField value="{!a.Name}"/> </apex:column> <apex:column headerValue="Billing City"> <apex:inputField value="{!a.BillingCity}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
If u use cusotm drop down u have to use datamodel or wrapperclass.
More Details abt wrapper class : http://wiki.apexdevnet.com/index.php/Wrapper_Class
I hope its help u..
Hi,
Thanks for your help, I will be trying this code.
Thanks,
prasuna