jQuery mask goes blank on MVC Validationhttp://forums.asp.net/t/1809941.aspx/1?jQuery+mask+goes+blank+on+MVC+ValidationMon, 04 Jun 2012 07:54:24 -040018099415008116http://forums.asp.net/p/1809941/5008116.aspx/1?jQuery+mask+goes+blank+on+MVC+ValidationjQuery mask goes blank on MVC Validation <p>I am using MVC3 in VS 2010 and jquery masked imput (jquery.maskedinput-1.3.js).&nbsp;&nbsp;</p> <p>When the client side validations occur, the textbox will go blank if there is an error, and&nbsp;in some cases it will also&nbsp;replace the custom ErrorMessage with the generic one(i.e.&nbsp; &quot;The field Price must be a number&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p> <p>Does anyone know why this may be happening and how to prevent it?</p> <p>For example:</p> <pre class="prettyprint">From the Model: [Required(ErrorMessage = &quot;* Price must be greater that $100&quot;)] [Min(100, ErrorMessage = &quot;* Price must be greater that $100&quot;)] [Display(Name = &quot;Price&quot;)] public double Price { get; set; } //The JQuery Call jQuery(function ($) { $(&quot;#Price&quot;).mask(&quot;$999999999&quot;, { placeholder: &quot;_&quot; }); });</pre> <p></p> 2012-06-01T16:51:02-04:005010028http://forums.asp.net/p/1809941/5010028.aspx/1?Re+jQuery+mask+goes+blank+on+MVC+ValidationRe: jQuery mask goes blank on MVC Validation <p>Hello</p> <p>If you are using javascritpt to perform valiation at browser side, then you perform the validation at server side and disable the error message to the client side. So the server side messages does not clash with the client side messages. But remember to perform server valiation anyway, otherwise malicious data can bypass the client side validation and go to your server side.</p> <p>&nbsp;</p> 2012-06-04T07:54:24-04:00