Would really appreciate help correcting my code to get this working!I am attempting to create a Visualforce page where users can add multiple child records at once. I want to add a list button to the related list on the parent object. Both are custom objects.The parent object in this scenario Sessions__c and the child object is Class_Enrollments__c. Not sure if this is applicable, but Groups_and_Classes__c is the parent of Sessions__c.I am new to development, so I reworked some code based on code I found online. Basically, I want users to be able to click a "Add Class Enrollments" button on the Class Enrollments list on the Session record. I want this to take them to a Visualforce page where they can add as many rows as needed, populating the Youth Name, Attendance, and Participation Note fields.I originally built this with a custom controller, and the visualforce page looked great, except the delete row function was not actually deleting the row. However, when trying to add the button to the page, I realized I have to use a Standard Controller. I've spent hours researching this at this point and have been unable to successfully add the standard controller to the visualforce page and use the controller I created as an extension. I've modified my controller to reference the standardsetcontroller, but then I get a "compile error=unknown token: Id". Basically, I'm so new to this that I'm in over my head. Could anyone please help me correct my code? I would greatly appreciate it.VF (not edited to reflect ways I tried to add standard controller):<apex:page controller="AddingEnrollmentsController"> <apex:form> <apex:variable var="rowNum" value="{!0}" /> <apex:pageBlock > <apex:variable var="rowNum" value="{!0}" /> <apex:pageBlockTable value="{!Class_EnrollmentsList}" var="CE"> <apex:facet name="footer"> <apex:commandLink value="Add" action="{!insertRow}"/> </apex:facet> <apex:column headerValue="Youth Name"> <apex:inputField value="{!CE.Youth_Name__c}"/> </apex:column> <apex:column headerValue="Attended?"> <apex:inputField value="{!CE.Attended_Class__c}"/> </apex:column> <apex:column headerValue="Participation Level"> <apex:inputField value="{!CE.Participation_Level__c}"/> </apex:column> <apex:column headerValue="Comments"> <apex:inputField value="{!CE.Comments_for_Treatment_Team__c}"/> </apex:column> <apex:column headerValue="Delete" > <apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}"> <apex:param value="{!rowNum}" name="index" /> </apex:commandLink> <apex:variable var="rowNum" value="{!rowNum+1}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!insertClass_Enrollments}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form></apex:page>Controller (again not updated to reflect my attempts to add the standardsetcontroller):public class AddingEnrollmentsController { Id SessionId; public List<Class_Enrollments__c> class_enrollmentsList {get;set;} public Integer rowNum{get;set;} public AddingEnrollmentsController(){ Id class_enrollmentsId = ApexPages.currentPage().getParameters().get('class_enrollmentsId'); SessionId=ApexPages.currentPage().getParameters().get('SessionId'); class_enrollmentsList = new List<Class_Enrollments__c>(); class_enrollmentsList.add(new Class_Enrollments__c()); } public pagereference insertClass_Enrollments(){ insert class_enrollmentsList; Pagereference page=new pagereference('/'+SessionId); Return page;} public void insertRow(){ class_enrollmentsList.add(new Class_Enrollments__c()); } public void delRow(){ rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index')); class_enrollmentsList.remove(rowNum); }}Any help is greatly appreciated!!!!
Want to bump this...could anyone please help? I would really appreciate any insight someone can offer. I'm a quick learner, but a bit in over my head with this.