I’m creating a form which allows users to add instances of fields. In order to allow the labels to be changed by the user, each field cannot be linked to a shared model instance.
Is it possible for the View to trigger the creation of a new Model instance in the Controller?
My plan currently is to have all the fields share one model for validation (not label or textfield) and then create model instances with a foreach loop upon form submission. I guess alternatively I could assign values to the same model in the foreach loop. After saving each instance will have served its purpose so it might as well just be reused.
My only reservation with this approach is that I will need different forms for creating and updating values.
I have no idea if this makes sense. I’m about to give it a shot but I’d appreciate other peoples thoughts or comments.
edit: apparently it’s possible with some Ajax magic and all sorts of crazy sauce. I’m working on it.
editv2: It is possible to send Ajax requests to the Controller from the Model. I’ve abandoned the approach but it’s possible.