即使字段验证器不满意,如何运行取消按钮代码?
我有一个为我的网站注册新用户的表格,并且页面上需要他们的字段验证器。
我想包含一个取消按钮,将表单重定向到主页,但除非满足必需的字段验证器,否则在单击取消按钮时不会运行代码。
即使表单未完全填写,如何运行取消按钮的代码?
I have a form to register new users for my site and their are required field validators on the page.
I want to include a cancel button that redirects the form to the main page but unless the required field validatiors are satisfied it will not run the code when the cancel button is hit.
How can I have the code for the cancel button run even if the form is not fully filled out??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将属性“ValidationGroup”应用于要验证的字段,因此一个按钮可以导致一组中的验证,而其他按钮可以导致另一组中的验证,前提是这些按钮的验证组设置为相同的名称。
如果您希望取消按钮根本不验证,请将其属性“causesvalidation”设置为 false
You can use the property "ValidationGroup" applied to the fields you want to validate, so one button can cause validation in one group and other button cause validation in another group provided the buttons have their validation groups set with the same name.
If you want the cancel button to not validate at all, set its property "causesvalidation" to false