jQuery Form Validation - https://github.com/victorjonsson/jQuery-Form-Validator - EasyTabs [closed]

StackOverflow https://stackoverflow.com/questions/23514007

문제

I use the jQuery plugin https://github.com/victorjonsson/jQuery-Form-Validator together with responsive tabs and a problem arises during validation!

  • Hidden fields seems to be validated. Is that a bug?

  • Is it possible to disabled the validation of a form using this
    plugin?

  • Is it possible to trigger the validation with an input of type
    "button"?

Thank you.

도움이 되었습니까?

해결책

The plugin tried to validate forms that not visible, and so the validation doesn't pass.

I'm guessing you mean inputs that is hidden. When you hide the input you should also remove, or rename, the attribute data-validation.

Is it possible to remove validation from a form?

Yes, simply remove or rename the attribute data-validation

function removeValidation($form) {
   $form.find('*[data-validation]').attr('data-validation', null);
}

Is it possible for input type to be "button"?

Yes, trigger validation when the button is clicked.

$.validate({
  form : '#my-form',
  onSuccess : function($form) {
     $form.get(0).submit();
  }
});

$('button.my-submit-button').on('click', function() {
  $('#my-form').trigger('submit');
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top