如何手动触发特定字段的验证?

时间:2018-07-25 07:30:02

标签: javascript jquery validation

下面的部分工作正常。在某些情况下,一个字段变为只读,在这种情况下,我必须验证该字段。

如何手动触发对特定字段的验证?

$('#myForm').formValidation({
  framework: 'bootstrap',
  err: {
    container: function($field, validator) {
      return $field.parent().parent().next('.messageContainer');
    }
  },
  icon: {
    valid: 'fa ',
    invalid: 'fa fa-exclamation-triangle',
    validating: 'fa fa-refresh'
  },
  fields: {
    'RC_BEAM_DESIGN_BS8110_V1_Model.Breadth_b': {
      err: 'popover',
      validators: {
        notEmpty: {
          message: 'Breadth must have value'
        },
        numeric: {
          message: 'Breadth must be Number'
        },
        between: {
          message: 'Breadth Range should be between 50 - 2500 ',
          min: 50,
          max: 2500
        }
      }
    },
    'RC_BEAM_DESIGN_BS8110_V1_Model.Depth_h': {
      err: 'popover',
      validators: {
        notEmpty: {
          message: 'Depth must have value'
        },
        numeric: {
          message: 'Depth must be Number'
        },
        between: {
          message: 'Depth Range should be between 50 - 2500 ',
          min: 50,
          max: 2500
        }
      }
    }
  }
});

0 个答案:

没有答案