Search code examples
jquerysafaribootstrapvalidator

Bootstrap validation failing for autocomplete safari browser


I am using bootstrap validator for my forms validations. I am facing issue for safari browser auto complete.

$('#registration_info_form').bootstrapValidator({
    message: 'This value is not valid',
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    verbose: false,
    fields: {
        Name: {
            message: 'Invalid format.',
            validators: {
                notEmpty: {
                    message: 'This field is required.'
                },
                stringLength: {
                    min: 2,
                    max: 100,
                    message: 'Name should be between 2 and 100 characters.',
                }
            }
        },
    }
});

I was facing issue for Mac chrome browser. To resolve this I have added following code which solved chrome issue.

$("#Name").change(function () {
    $('#registration_info_form').bootstrapValidator('revalidateField', 'Name');
});

But, now I am facing issue for Mac safari browser. Any help is appreciated. Thanks in advance.


Solution

  • I have got the solution :)

    I have used blur event. On blur event I am again validating same field.

    $("#Name").blur(function () {
        $('#registration_info_form').bootstrapValidator('revalidateField', 'Name');
    });