You need to sign in to do that
Don't have an account?
AmbigaRam
Problem in saving page when using add row functionality
Hi,
I am creating the page which consists some fields that are not present in row and some other fields that are present in row.
I created the custom controller which add the row functionality in my page.
When I am going to save the page , It does not save the page which is in need of other fields (not in row) .
Can anyone help for me to show how to save by means of pagereference method fields (in rows and not in rows)?
The following are my code,
Public class MultiAddRowFn{ //Will hold the master records to be saved public list<Mentor__c> lstmarf= new list<Mentor__c>(); //List of the inner class public list<innerClass> lstInner {get;set;} //Will indicate the rows to be deleted public string selectedRowIndex {get;set;} //no.of rows added/records in the inner class list public integer count=1; ////save the records by adding the elements in the inner class list to lstAcct,return to the same page Public pageReference save() { PageReference pr = new PageReference('/apex/MultiAddRowFn'); for(integer j=0; j<lstInner.size(); j++) { lstmarf.add(lstInner[j].ment); } update lstmarf; pr.setRedirect(True); return pr; } //add one or more row public void add() { count=count+1; addMore(); } //Begin addMore public void addMore() { innerClass objInnerClass = new innerClass(count); //add the record to the inner class list lstInner.add(objInnerClass); system.debug('lstInner---->'+lstInner); }/*end add more*/ /*Begin Delete*/ public void Del() { system.debug('selected row index---->'+selectedRowIndex); lstInner.remove(Integer.valueOf(selectedRowIndex)-1); count = count - 1; }/*End del*/ /*Constructor*/ public MultiAddRowFn(ApexPages.StandardController ctlr) { lstInner=new list<InnerClass>(); addMore(); selectedRowIndex ='0'; }/*end constructor */ /*Inner Class*/ public class innerClass { public string recCount {get; set;} public Mentor__c ment {get; set;} public innerClass(Integer intCount) { recCount = string.valueof(intCount); ment=new Mentor__c(); } } }
Thanks and Regards.,
Ambiga
Can you please show error message and page code.
Hi,
Following is the error
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Class.MultiAddRowFn.save: line 26, column 1
Following is the page code
Pls help me to solve this problem.
Thanks and Regards.,
R.Ambiga