Question

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.

Was it helpful?

Solution

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');
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top