I was wondering how can I implement a view that allows the user to enter multiple(unknown) number of records in related models..
for example, I have two models called groups and users. And I want to implement a view that allows me to create a group ( which is easy ) and in the same view let me create multiple number of users who belong to this group.
I hope that my question is clear, if not just let me know ..
In the backend, use a saveAll($data), preparing your data like:
In the view, you want to prepare your form such that it has correctly array’d keys:
If you want to dynamically add users to the form, consider using javascript to inject new
inputelements.See this for more info.