嵌套形式替代方案
我在 html 中做了一些购物车 ui。 我想避免嵌套形式,但任何允许我将请求路由到两个不同处理程序的解决方案都最好包含数据。有两个请求:删除项目和签出。
我想知道嵌套形式的替代解决方案是什么。
请帮忙。
谢谢。
i doing some shopping cart ui in html.
I would like to avoid nested form but any solution which allow me to route request to two different handler is preferable with the data included. There are two requests are delete item and check out.
I wonder what is the alternative solution to nested form.
Please help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTML 中不能有嵌套表单,因此您必须使用替代方案。
您发布的表单不必位于您要发布的信息所在的位置。您可以使用 Javascript 将页面中某些字段的信息复制到页面其他位置的表单内的隐藏字段中,然后发布该表单。
这也将使页面变得更简单。您可以使用单个表单来执行删除功能,而不是为每个项目使用一个表单。
You can't have nested forms in HTML, so you have to use an alternative.
The form that you post doesn't have to be located where the information that you want to post is located. You can use Javascript to copy the information from some fields in the page into hidden fields inside a form somewhere else on the page, and post that form.
This will also make the page simpler. You can use a single form for the delete function, instead of having one form for each item.