I am testing mvc field validation. For this I did a new ASP MVC 3 project in VS2010. I selected razor view engine for it. The default project generates me a home account controllers and a logon action.
In the LogOn view I want to validate fields when field looses focus. If I go on username and I press tab without changing the field the validation does not trigger.
Is this the normal behavior? … or I miss something.
If this is the normal behavior … how can I validate field after it loses focus even if it was not changed.
I did not changed anything at the application template that vs generate for me.
If you are using jquery 1.7.1 with unobtrusive validation, something like this should do the trick:
If using an older version of jquery, change to this: