[英]How to work with several forms of the same type at the same time - Symfony2
I have a form for adding an item - its name, its price, the date when it was bought and some notes. 我有一张添加物品的表格-名称,价格,购买日期和一些注意事项。 But since there will be a lot of items, it will be uncomfortable to submit each one by itself.
但是由于会有很多项目,所以自己提交每个项目都会很不舒服。 What I want to do is to repeat the form several times and with one commit several items to go to the databae.
我想做的是重复几次该表格,一次提交几项即可进入数据库。 Something like this:
像这样:
Name | Price | Date | Notes
Name | Price | Date | Notes
Name | Price | Date | Notes
Submit
where the user will write and commit 3 items at once. 用户将一次写入并提交3个项目。 Sorry for the bad explaining, I hope that it won't be too messy.
很抱歉解释不正确,我希望它不会太凌乱。 I should implement this with Symfony2.
我应该用Symfony2实现它。 Thank you very much for the help!
非常感谢你的帮助! :)
:)
Read about embeded forms. 阅读有关嵌入表格的信息。 Or collection widget.
或集合小部件。
http://symfony.com/doc/current/reference/forms/types/collection.html http://symfony.com/doc/current/reference/forms/types/collection.html
http://symfony.com/doc/2.0/cookbook/form/form_collections.html http://symfony.com/doc/2.0/cookbook/form/form_collections.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.