Bootstrap validator resetForm

Nk SP picture Nk SP · Oct 31, 2014 · Viewed 16.3k times · Source

I am using bootstrapvalidator with Bootstrap 3.3
I need to reset a form in a modal dialog.
I used the right method but it does not work into the modal dialog.

 $('#emailForm').bootstrapValidator("resetForm",true); 

If I open the modal and insert an email, and then try to reset the form, the validation controls are still there.

JSFiddle

Answer

3y3skill3r picture 3y3skill3r · Oct 31, 2014

It is simple, you just only need to add

excluded: [':disabled'],

Into validation init.

Example:

    $('#emailForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        excluded: [':disabled'],
        fields: {
            email: {
                validators: {
                    emailAddress: {
                        message: 'The value is not a valid email address'
                    }
                }
            }
        }
    });