How do you emulate the behavior of the password field without using @Html.PasswordFor. In other words, I want to keep it as a text field (@Html.EditorFor), but show a masked character (*) instead of the typed-in character. The reason I don't want to use a password field is because this is not actually for a password, but for some other sensitive data, and using a password field means Chrome prompts the user to save the password.
I know I could use a javascript using onkeyup to convert the typed-in character to a masked character and save the actual character in a hidden field, but the problem is that the model validation on this field would reject that character.
What is the best way to approach this problem?
View
@Html.EditorFor(model => model.Salary)
Model
[RegularExpression("([1-9][0-9]*)")] //model validation would reject asterisks.
public string Salary { get; set; }