Jquery 动态表单 - 快速问题
我有一个表单,顶部包含四个不同的单选按钮 - 表单的其余部分根据选择的单选按钮而变化。 目前,表单的每个“部分”都在其自己的字段集中,我使用 Jquery 隐藏/显示它们。
我怎样才能只提交与表格填写部分相关的数据? 我不想在表格上提交三个空白区域,而只提交一个已部分填写的区域。
谢谢。
I have a form and up the top it contains four different radio buttons - the rest of the form changes depending on which of these radio buttons are selected. Currently each 'part' of the form is in its own fieldset and I'm hiding/showing these with Jquery.
How can I only submit the data that is relevant to which part of the form is filled out? I don't want to submit three empty areas on the form and only one filled in part.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需创建三种不同的表单,将它们之间的字段分开,然后提交正确的表单即可。 它们都可以指向同一个 URL...
Just create three different forms, separate your fields between them and then submit the right one. They can all point to the same URL...
您可以 $("#fieldset1").remove() 表单提交上的字段集。 不像 nivhab 提议的那么优雅,但它也是一种选择
you could $("#fieldset1").remove() the fieldsets on form submit. not as elegant as nivhab proposed but it's an alternative too