Validation in MVC page does not work in IE
After using validation in MVC pages, once the validation message is displayed IE hangs but in mozilla it is working. What would be the problem? Please suggest the solution.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
prasannaPosted Jun 3, 2010, 12:53 AM
<td class="tar">
<%= LabelHelper.MultilingualLabel(ViewData["displayText"].ToString() + "Name", "name")%>
td>
<td>
<%= Html.TextBoxFor(m => m.Name, new { @class = "textbox140" })%>
<%= Html.ValidationMessageFor(m => m.Name, "", new { Style = "display:none" })%>
td>
2. Jquery to handle the error: validForm(form) will be called before posting the data
function validForm(form) {
var errs = Sys.Mvc.FormContext.getValidationForForm(form).validate('submit');
$("#Validations").show();
return (!(errs && errs.length));
}
3. The div which is used to display error
<div class="errorMessage" id="Validations" style="display: none">
<div class="msgIcon">
<img src="../../../Content/main/images/errorIcon.gif" alt="Error" title="Error" class="msgBtn" />div>
<div class="errorText" id="Div5">
<%= Html.ValidationSummary(false,"Please correct the errors and try again.") %>