ResetForm bootstrap installer

I am using bootstrapvalidator with Bootstrap 3.3
I need to reset a form in a modal dialog.
I used the correct method, but it doesn't work in the modal dialog.

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

      

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

JSFiddle

+3


source to share


2 answers


It's simple, you just need to add

excluded: [':disabled'],

      

In confirmation of initialization.



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

      

+6


source


I know this is very old.

$("#emailForm").data('bootstrapValidator').resetForm();

      



Clears the form validation, but does not clear the fields. This is good in my case. Using one form for several clients. It's easier for the visitor to get their name and email address, but just retype the message. So I just clear the message field.

+1


source







All Articles