javascriptjquerycsstwitter-bootstrapjqbootstrapvalidation

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


Solution

  • 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'
                        }
                    }
                }
            }
        });