ASP.NET MVC 3:远程验证后表单未发布
我要疯了! 我的代码有点太多,无法在这里发布,但问题很简单:如果我装饰模型的字段,编辑表单将不再触发(即单击提交按钮,什么也不会发生)。
我可以在这里发布远程验证声明和函数:
[Required]
[Remote("CheckNomeAssociazione", "Associazioni")]
public string Nome { get; set; }
这就是函数:
public JsonResult CheckNomeAssociazione(string Nome)
{
return Json(true, JsonRequestBehavior.AllowGet);
}
如果我注释“[Remote...”行,则代码是完美的。如果我让它就位,应用程序就会进入远程验证器,但不会执行任何其他操作。 有人有相同或类似的问题吗? 提前致谢 安德里亚
I'm going crazy!
My code is a little too much to post here, but the problem is simple: if I decorate a field of my model, the editing form doesn't fire anymore (i.e. clicking the submit button, nothing happens).
I can post, here, the remote validation declaration and function:
[Required]
[Remote("CheckNomeAssociazione", "Associazioni")]
public string Nome { get; set; }
and this is the function:
public JsonResult CheckNomeAssociazione(string Nome)
{
return Json(true, JsonRequestBehavior.AllowGet);
}
If I comment the '[Remote...' row, the code is perfect. If I let it in place, the application steps into the remote validator, but doesn't do anything else.
Anyone having same or similar problem?
Thanks in advance
Andrea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能有点晚了,但作为更新,这在 jQuery Validate 1.8 中不再是问题。它不再破坏
$.getJSON()
,即使是最新的(截至本文 jQuery 1.5.2)也可以工作。This may be a little late, but just as an update, this is no longer an issue in jQuery Validate 1.8. It no longer breaks
$.getJSON()
, even the latest (as of this post jQuery 1.5.2) works.尝试这样说:
希望有帮助
try to put this:
Hope it helps
我想我已经找到了这个问题的原因。我们已将 jQuery 升级到 1.5。它似乎破坏了远程验证例程。恢复到 1.4.4 解决了我们的问题,远程验证器再次开始正常工作。
这篇文章更详细一些: jQuery Validate 1.7在 jQuery 1.5 上破坏 $.getJSON() ?
I think I've spotted the cause of this issue. We'd upgraded our jQuery to 1.5. It seems to break the Remote validation routines. Reverting back to 1.4.4 resolved our issues and the Remote validator started working properly again.
This post goes into a little more detail: jQuery Validate 1.7 breaks $.getJSON() on jQuery 1.5?