我有以下代码,它在所有浏览器中运行良好,并在用户尝试提交表单而不输入字段名称时显示错误消息。
<div class="row medium left">
@Html.TextBox("FirstName", Model.FirstName, new { @class = "field blink medium required", @title = "First Name*" })
<div class="error-msg">
@Html.ValidationMessageFor(m => m.FirstName)
</div>
</div>
<div class="row medium left last">
@Html.TextBox("LastName", Model.LastName, new { @class = "field blink medium required", @title = "Last Name*" })
<div class="error-msg">
@Html.ValidationMessageFor(m => m.LastName)
</div>
</div>
验证消息在除IE之外的所有浏览器中都有效。有什么不对,我可能忽略了什么错?
IE中呈现的HTML:
<input name="FirstName" title="First Name*" class="field blink medium required error" id="FirstName" type="text" value="First Name*" data-val-required="The First Name field is required." data-val-length-min="3" data-val-length-max="50" data-val-length="Minimum of 3 characters." data-val="true" AUTOCOMPLETE="OFF">
<div class="error-msg">
<span class="field-validation-valid" data-valmsg-replace="true" data-valmsg- for="FirstName"></span></div>