使用bootstrap模式使用jquery验证加载不同的内容

I'm using bootstrap model to edit table values. It works perfectly. But when I'm using BootstrapValidator plugin to validate that modal there's a problem. Problem is when I click edit first time and load model it works normally. Then if I click edit again in the same page, validation errors belongs to previous one still shows. Screen shot displays here,

enter image description here

Modal Call

<a data-toggle="modal" data-target="#dealModal" onclick="ajax_get_edit_data('.$id.');"></a>

Validations

<script type="text/javascript">
    $(document).ready(function () {     
    $('#dealForm')
        .bootstrapValidator({
            message: 'This value is not valid',
            fields: {
                deal_description: {
                    message: 'The deal discription is not valid',
                    validators: {
                        notEmpty: {
                            message: 'The deal discription is required and can\'t be empty'
                        }
                    }
                }
            }
        })
        .on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();

            // Get the form instance
            var $form = $(e.target);

            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');

            // Use Ajax to submit form data
            //$.post($form.attr('action'), $form.serialize(), function(result) {
            //  console.log(result);
            //}, 'json');
        });
</script>
查看全部
douren1928
douren1928
2014/08/18 06:31
  • php
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复