动态嵌入表单
我希望使用 Doctrine 在 Symfony 1.4 中动态添加嵌入表单。
我主要想做的是:
1)仅根据是否选中复选框来显示关系
2)如果选中,则显示嵌入表单
3)然后能够添加新的嵌入表单或删除现有表单
我见过 ahDoctrineEasyEmbeddedRelationsPlugin
,它在配置方面看起来相当不错。唯一的问题是 'newFormsInitialCount'=> 1,
表示默认始终有 1 个表单。我默认只需要 0 个表格。
我还看过一些教程,但默认情况下所有教程似乎都至少有一种关系。
对我来说,embeddedForm 需要是可选的,并且仅在需要时显示。
谢谢
I'm looking to add an embeddedForm dynamically in Symfony 1.4 using Doctrine.
What I'm mainly looking to do is:
1) Only show the relation based on whether or not a checkbox has been ticked
2) If checked, show the embeddedForm
3) Have then the ability to add a new embeddedForm or delete an existing form
I have seen ahDoctrineEasyEmbeddedRelationsPlugin
, which looks pretty good with los of configuration. The only problem was that 'newFormsInitialCount'=> 1,
means that there is always 1 form as default. I need 0 forms as default and only.
I've also seen a couple of tutorials, but all seem to have at least one relation by default.
For me, the embeddedForm needs to be OPTIONAL, and only display when needed.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据以下链接关注信息:
首先是关于使用 ajax 添加“子表单”,从第二个衍生而来,您可以隐藏不需要的表单字段并根据 javascript 切换它们(例如 jQuery.toggle()))!
Follow information based on these links :
First is about adding "subforms" with ajax, derived from second you could hide the unneeded form fields and toggle them per javascript (e.g. jQuery.toggle())) !