First option of required checkboxes/checkboxes other become required under conditional state while wrapper type set to 'form element'

Created on 11 April 2024, 3 months ago

Problem/Motivation

The first checkbox input field's 'required' attribute is not removed when other options are selected.

Form cannot be submitted due to html input validation still attached unless selection of first option.

Steps to reproduce

  1. Install drupal 10.2.5, webform 6.2.x
  2. Create new webform, use demo webform yaml file
  3. Create webform reference field to content type basic page.
  4. Create new basic page and select new webform.
  5. Try to submit by selecting agree to visualize the checkboxes element, and any other options that ain't the first option.
  6. Submit will fail as the required field is not removed after checkbox selection.

Demo video:

Discovered $element selection is empty on checkboxes action in webform.states.js function statesCheckboxesRequiredEventHandler, the root cause is because of the class name changed from '.js-webform-type-checkboxes' to '.js-form-type-checkboxes' when using 'form element' as wrapper element.

This occurs to checkboxes and checkboxes other

Checkboxes

Checkboxes others

Proposed resolution

Add .js-form-type-checkboxes and .js-form-type-webform-checkboxes-other to function statesCheckboxesRequiredEventHandler in js/webform.states.js

Remaining tasks

None, this resolves the issue.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Needs review

Version

6.2

Component

Code

Created by

πŸ‡ΉπŸ‡ΌTaiwan g-brodiei

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024