Problem/Motivation
Currently when WET-BOEW inline form validation is enabled for a webform with multiple pages, the Previous button on the webform triggers the validation. This means in order to go back a page, the user must complete all of the required fields on the current page, which is not ideal. Users should be able to go back a page without triggering validation.
Steps to reproduce
On a paged webform, add a required field to the second page. Then when filling out the webform, go to the second page, leave the required field blank, and click the Previous button. You will see wet-boew validation kicking in.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | wxt-skip-validation-previous-button-3564997-2.patch | 2.52 KB | smulvih2 |
Comments
Comment #2
smulvih2We needed to disable WET-BOEW inline client-side validation when users click the Previous button on multi-step Drupal Webforms. Users should be able to move back without being blocked by validation errors.
Approaches Tested
1. HTML5
formnovalidateattributeAdded via
hook_webform_submission_form_alter().Result: Browser validation disabled, but WET/jQuery Validate still executed, so errors continued to appear.
2. jQuery Validate
.cancelclass trickAdded
class="cancel"to the Previous button.Result: Works in plain jQuery Validate, but WET wraps validation and ignores this path, so validation still triggered.
3. Using global
once()to intercept clickJS attempted to intercept click and re-submit.
JS correctly attached, but validation still fired before the handler, indicating event order problem.
Final Solution
The issue was order of execution. WET’s validation submit handlers were firing before our script. The successful approach was to:
data-wet-skip-validation="1"addEventListener(..., true))preventDefault()and stop propagationform.submit(), bypassing WET/jQuery handlersResult:
Previous button now navigates back a page with no inline validation, while Next / Submit continue to enforce WET validation normally.
Comment #3
smulvih2Included in 6.1.x.