I'm looking into using CakePHP to build a web application. The sticking point is that I need to be able to generate forms that contain repeatable subforms. These subforms would consist of sets of fields with a delete button and a single add button. Clicking the add button would add a new set of fields, while clicking any of the delete buttons would delete that single set of fields. These buttons would use JavaScript to add and delete the subforms.
Example: The company has a Client, and this Client has many Contacts. The form for this situation would consist of a form to fil开发者_如何学JAVAl in the client data, and the subform would allow the user to enter in a name and email for each of the contacts.
Is anyone aware of any existing libraries for CakePHP that do this? Alternatively, is anyone aware of a well built generic library for performing this task?
that is a frontend issue and nothing to do with cake, its all done with javascript so something like jquery is what you would need.
something like http://www.web-design-talk.co.uk/58/adding-unlimited-form-fields-with-jquery-mysql/
look at the demo found http://www.web-design-talk.co.uk/examples/2/1/
I ended up writing a library for this. Maybe I'll post it someday when it's of a bit higher quality than an additional Form Helper layer.
精彩评论