Father/Son Data Manipulation

Hello! I need something similar to this.

I am wondering if someone could provide some sample controller/template code that would allow me to build something so on the add and edit pages, you can also add/edit/delete the data of an associated son model. I already tried a few things, but I couldn’t get anything working properly. I want the ability for the user to add/edit/delete all the records on one page, and that is what I am having trouble figuring out.

Thanks!

My first response on that thread points to my open-source software, which has multiple examples of how to do this.

And you’re generally going to get better responses if you show “here’s what I’ve tried, and this is the detail that’s not working”. There are multiple ways to approach this, depending on how you want your process to work, and they are quite different from each other.

For example, do you want to click a button to add a blank line, fill that in, and it gets saved only when you save the page, or always have a blank line showing somewhere on the page, fill that in, and click a button to save and add it right away?

Yeah, I was thinking something along the lines of a table similar to the screenshot, with a “New Record” button adding a new line that then allows a form to be filled out, and all of which is submitted (along with the main form) at the same time on save.

I am going to try a few more things with AJAX since right now doing it with non-refreshing forms on the client-side seems to be my best bet (I was trying some traditional forms and that wasn’t working) and I will update with more specific things on what is/isn’t working.

Thanks!