function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to structure Adding Children when working w Parent in VF Wizard

So I have a visualforce wizard that takes you through each page to collect the info for the object.  On one of the pages, I want to allow them to add one or more of a custom child object (in this case, literally all the person's Children).


I can't seem to figure out how to structure this.  Do I need to create the child in the controller before I try to collect their info on the VF page?  But if they don't have any children, I don't want to have created a child already.  I assume I need a way to cycle through each child, but how?  Can you even add children to a parent that hasn't actually been saved yet?  Does it need a whole new controller or something?  I'm sure there's something out there I just don't know about yet.


The page looks like:

Checkbox if they have children

Default is unchecked

If user checks, then output panel appears to fill in info for first child

Buttons to save and done (go to next page), save and add another child (reload output panel blank for new child), etc


I've got the checkbox controlling the output panel, then got stuck on how this should be structured.  Once I do it for the Children, then I can do it for the other 5 child objects.