Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap validator resetForm

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

like image 496
Nk SP Avatar asked Dec 25 '22 02:12

Nk SP


1 Answers

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'
                    }
                }
            }
        }
    });
like image 92
3y3skill3r Avatar answered Dec 28 '22 07:12

3y3skill3r