0

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:

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.