I am using MVC3 in VS 2010 and jquery masked imput (jquery.maskedinput-1.3.js).
When the client side validations occur, the textbox will go blank if there is an error, and in some cases it will also replace the custom ErrorMessage with the generic one(i.e. "The field Price must be a number")
Does anyone know why this may be happening and how to prevent it?
For example:
From the Model:
[Required(ErrorMessage = "* Price must be greater that $100")]
[Min(100, ErrorMessage = "* Price must be greater that $100")]
[Display(Name = "Price")]
public double Price { get; set; }
//The JQuery Call
jQuery(function ($) {
$("#Price").mask("$999999999", { placeholder: "_" });
});
ARTIS
Member
69 Points
94 Posts
jQuery mask goes blank on MVC Validation
Jun 01, 2012 04:51 PM|LINK
I am using MVC3 in VS 2010 and jquery masked imput (jquery.maskedinput-1.3.js).
When the client side validations occur, the textbox will go blank if there is an error, and in some cases it will also replace the custom ErrorMessage with the generic one(i.e. "The field Price must be a number")
Does anyone know why this may be happening and how to prevent it?
For example:
From the Model: [Required(ErrorMessage = "* Price must be greater that $100")] [Min(100, ErrorMessage = "* Price must be greater that $100")] [Display(Name = "Price")] public double Price { get; set; } //The JQuery Call jQuery(function ($) { $("#Price").mask("$999999999", { placeholder: "_" }); });