【发布时间】:2011-06-21 13:07:26
【问题描述】:
我正在使用 MVC3。我想在提交页面时在客户端添加自定义检查..但是这样做默认验证不起作用...
@using (Html.BeginForm())
{
@Html.TextBoxFor(model => model.Title, new { maxlength = 250 , style = "width:450px;" })
@Html.ValidationMessageFor(model => model.Title)
<input type="submit" value="Submit" id="submit"/>
}
当我点击提交按钮时,我会在下面写一个验证
$('#submit').click(function () {/*code for validation*/ if not satisfied then return false; else return true; }
这工作正常。如果返回 false ,模型提供的默认验证不起作用
IE。 @Html.ValidationMessageFor(model => model.Title)此代码不起作用[错误消息未显示]。单击按钮时如何验证默认验证?
【问题讨论】:
标签: jquery validation asp.net-mvc-3