Question

The validation sometimes works when tabbing but not always. For example, load webpage, delete (backspace) data from required field, tab - validation sometimes fires, sometimes doesn't.

If I delete the same field's data and submit the form, validation fires and submission fails. Then validation on this field works correctly from then on.

Is this the standard functionality of unobtrusive javascript?

Was it helpful?

Solution

You could put the following script to enable validation when tabing out of a field:

$(function () {
    $('form').data('validator').settings.onfocusout = function (element) {
        $(element).valid(); 
    };
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top