0

我在我的引导表单上使用formValidation了框架,验证工作完美,电子邮件成功发送到邮件地址,但是在将这些行添加到表单验证之后:

.on('success.form.fv', function(e) {
            // Prevent submit form
            e.preventDefault();

            var $form     = $(e.target),
                validator = $form.data('formValidation');

            // Show the modal
            $('#helloModal')
                .modal('show');

            $form
                .formValidation('disableSubmitButtons', false)  // Enable the submit buttons
                .formValidation('resetForm', true);             // Reset the form
        });

电子邮件不再发送。一切正常,但我认为由于上述代码,电子邮件的 PHP 部分没有处理。

完整的 Jquery 表单验证代码:

    <script type="text/javascript">
$(document).ready(function() {
    $('#defaultForm').formValidation({
        message: 'This value is not valid',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {

            firmname: {
                validators: {
                    notEmpty: {
                        message: 'The Firm name is required and can\'t be empty'
                    }
                }
            },
            contactname: {
                validators: {
                    notEmpty: {
                        message: 'The Contact name is required and can\'t be empty'
                    }
                }
            },
            phone: {
                validators: {
                    notEmpty: {
                        message: 'Phone number is required and can\'t be empty'
                    }
                }
            },
            address: {
                validators: {
                    notEmpty: {
                        message: 'Address is required and can\'t be empty'
                    }
                }
            },
            email: {
                validators: {
                    notEmpty: {
                        message: 'The email address is required and can\'t be empty'
                    },
                    emailAddress: {
                        message: 'The input is not a valid email address'
                    }
                }
            },            
            optradio1: {
                validators: {
                    notEmpty: {
                        message: 'Please choose one of the option'
                    }
                }
            },
            optradio2: {
                validators: {
                    notEmpty: {
                        message: 'Please choose one of the option'
                    }
                }
            },
            optradio3: {
                validators: {
                    notEmpty: {
                        message: 'Please choose one of the option'
                    }
                }
            },
            optradio4: {
                validators: {
                    notEmpty: {
                        message: 'Please choose one of the option'
                    }
                }
            }
        }
    }).on('success.form.fv', function(e) {
            // Prevent submit form
            e.preventDefault();

            var $form     = $(e.target),
                validator = $form.data('formValidation');

            // Show the modal
            $('#helloModal')
                .modal('show');

            $form
                .formValidation('disableSubmitButtons', false)  // Enable the submit buttons
                .formValidation('resetForm', true);             // Reset the form
        });
});
</script>
4

0 回答 0