  $(document).ready(function() {
    $('#contact_form').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        submitHandler: function(validator, form, submitButton) {
        $('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ...
                $('#contact_form').data('bootstrapValidator').resetForm();
            var bv = form.data('bootstrapValidator');
            $.post(form.attr('action'), form.serialize(), function(result) {
                console.log(result);
            }, 'json');
      },
        fields: {
            name: {
                validators: {
                        stringLength: {
                        min: 2,
                    },
                      
                }
            },
			address: {
                validators: {
                     stringLength: {
                        min: 8,
                    },
                    notEmpty: {
                        message: 'Isi Alamat Anda'
                    }
                }
            },
             
			 phone: {
                validators: {
                     stringLength: {
                        max: 13,
                    }

            },
			 }
            email: {
                validators: {
                    emailAddress: {
                        message: 'Isi E-mail Anda Dengan Benar'
                    }
                }
            },
            
            username: {
                validators: {
                        stringLength: {
                        min: 2,
                    },
                      
                }
            },
            password: {
                validators: {
                     stringLength: {
                        min: 4,
                    },
           
                }
            },
            }
        })
        $('#contact_form').data('bootstrapValidator').resetForm();
}); 