Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This issue was previously fixed in If radio buttons are required but not filled form is nevertheless submitted but it looks like the fix was removed by mistake in Checkboxes don't support #states required
Comment | File | Size | Author |
---|---|---|---|
#11 | 2945890-11.patch | 7.17 KB | andypost |
| |||
#11 | 2945890-interdiff-10.txt | 893 bytes | andypost |
Comments
Comment #2
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedAttaching patch to re-add the lines fixing the issue.
Comment #3
andypostjquery.once already depends on jquery
Comment #4
andypostComment #5
andypostI guess it related to core issues
- #2945727: Form radios/checkboxes elements should have js-form-wrapper class
- #2731991: Setting required on radios marks all options required
Comment #6
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedRemoving
core/jquery
dependencies as suggested in #3Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe webform.element.radios.js library was moved to webform.states.js
@see https://cgit.drupalcode.org/webform/tree/js/webform.states.js#n78
I did this so that all the #states API code was in one place. My mistake was removing the code to handle radios that are not conditionally required, which should stay in webform.element.radios.js. The code in webform.element.radios.js can be cleaned up and simplified to only handle radios that are not conditionally required.
Below is an example of radios that not conditionally required.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch was tested with the Bartik and Bootstrap theme.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedDarn. I just noticed my patch did not include any changes to webform.element.radios.js and removed this file.
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #11
andypostMinor nit - no reason to search all over whole DOM in context of behavior
Nice cleanup of deps!
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedGreat catch!!!
Comment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented