如何在验证事件上显示弹出窗口?
看来我一直在努力寻找一个好的解决方案来解决我的问题。我们有一个 MVC 3 应用程序和一个表单,我们使用数据注释对其进行验证。在电子邮件字段中,我有一个 RemoteAttribute 来检查电子邮件是否是唯一的。 我需要实现这个:
如果电子邮件是唯一的 - 一切都很好,我们不需要做任何事情。
如果电子邮件不是唯一的 - 我们需要显示一个带有是\否选项的模式弹出窗口。如果用户 选择“是” - 该字段将有效,如果“否” - 字段无效,我们需要显示一条弹出消息。
不幸的是,我找不到这个
小更新的任何好的解决方案:我不想验证整个表单:仅验证电子邮件字段。在这种情况下,无法真正理解如何使用 jQuery 或 ValidationSummary 中的 form.Validate
It looks like I'm stuck trying to find a good solution for my issue. We have an MVC 3 application and a form, which we validate using Data Annotations. On Email field I have a RemoteAttribute which checks, that Email is unque.
The this I need to implement:
If Email is unique - everything is ok, we don' tneed to do anything.
If Email is not unque - we need to show a modal popup window with a yes\no choice. If user
chooses "yes" - the field will be valid, if "no" - field is invalid and we need to show a popup message.
Unfortunatelly, I couldn't find any good solution for this
Small update: I don't want to validate the whole form: only the Email field. In this case, can't really understand how to use form.Validate from jQuery or ValidationSummary
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
在您的视图中为 ModelState: 的错误创建容器,
并在视图的脚本部分中:
Try this:
In your view create container for errors form ModelState:
and in script section of your view:
您可以使用 jquery validate 来执行此操作:
这是您需要的吗?
希望这有帮助:)
You can use jquery validate to do this:
Is this the thing you need?
Hope this help :)