Reputation: 13178
I have a form in Symfony2 and I want to give the user an option to add a row to it, in case there's more information they want to provide. I know in JavaScript you can do this, is there a way to do it in symfony2 using the framework?
If not, what's the best possible way around it? With all the validation and everything, not finding any viable option while searching on Google... Thanks for any suggestions!
Upvotes: 4
Views: 2450
Reputation: 14136
You want to add a dynamic field to your form? There's a very infomative article about this actually; I found it really useful implementing something similar:
http://sf.khepin.com/2011/08/finally-through-symfony2-forms-and-collectiontype-make-it-dynamic/
He also created an example bundle:
https://github.com/khepin/ProductBundle
Upvotes: 5