如果表格有多个按钮,如何防止提交表格?
我正在尝试提交表格,但它包含多个按钮,例如浏览文件按钮等。当我单击其他按钮时,表格正在提交。如何防止它?并仅以一个特定的按钮给出提交。
Environment Name This field is required This field requires minimum 4 characters You exceeded maximum limit KUBE Config Browse This field is required Clear CreateI am trying to submit a form, but it contains multiple button like browse file button etc.When I click other button, form is submitting.How to prevent it ?. And give submit only in one specific button.
Environment Name
This field is required
This field requires minimum 4 characters
You exceeded maximum limit
KUBE Config
Browse
This field is required
Clear
Create
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很简单,只需在其他按钮中添加按钮类型即可。
默认情况下,每个按钮类型都提交(键入='submit')。
因此,只需将其他按钮添加到type ='button'。仅给type ='submit ='subm'提交按钮即可。
例如:
It is very simple, Just add button type to other buttons.
By default every button type is submit(type='submit').
So just add other buttons to type='button'.And only give type='submit' for submit button.
eg: