@Scripts
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
@View
@using (Html.BeginForm("TestModelState", "RandD", FormMethod.Post, new {id="form123" }))
{
@Html.TextBoxFor(x => x.htmlText, new { style="display:none"})<br />
@Html.ValidationMessageFor(x => x.htmlText)
<div>
@Html.TextBoxFor(x => x.Uprop1)<br />
@Html.ValidationMessageFor(x => x.Uprop1)
</div>
<input type="submit" value-="Submit" onclick="abc()" />
}
WHAT I have tried
- Replaced ignore: ":hidden", with ignore: "", inside validate.js
var validateMeta = $('#form123').validate(); validateMeta.settings.ignore = "";
$.validator.setDefaults({ignore: ""});
$.validator.setDefaults({ ignore: [] });