I have a multistep webform with required fields. The problem is that when I press the "previous"button in order to go to the page before the validation triggers and does not allow me to change the page. How can I disable the validation if the "previous" button is pressed?

I followed this question but it didnt work by adding this code:

  $form['actions']['wizard_prev']['#validate'] = ['::noValidate'];
  • Where did you write that code? – user72672 Sep 13 '19 at 6:32
  • @Jdrupal in hook_form_alter. I also use the drupal.org/project/clientside_validation module – Dimitris Markopoulos Sep 13 '19 at 6:46
  • 1
    You could try $form['actions']['wizard_prev']['#limit_validation_errors'] = []; instead. – user72672 Sep 13 '19 at 7:11
  • If the validation is set with JS, you can't remove it by PHP. – berramou Sep 13 '19 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.