Model for a dynamic form


Need help to figure this out.

I have two tables users and usersfriends.

The users table hold info for a single user and the usersfriends table is table in which the user can input names of as many friends one has. Each friend is a new row in the table.

Adding users is basically a static single form with its controller and model. I have successfully generated this, the problem I am facing is with creating the controller and model for the usersfriends table.

The usersfriends form is a dynamic form with a add more button to add more input fields as and when the user feels. Each new input accounts for a new row in the table when the form is finally submitted. Any idea how to generate the model and controller for such a form.

Have you tried the tabular input example in the docs?

You could add a little ajax in order to add fields on the fly.

Also take a look at this wiki.