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

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

Pregunta

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.

¿Fue útil?

Solución

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');
});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top