Using webform conditions to set a checkbox element to not required does not work as intended. The user interface is updated accordingly, but the required attribute is still present, hence making it impossible to submit the form.
The bug is only present in case of a checkbox, but *not* for a radio buttons. It also works as intended if the element is hidden instead.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | webform_conditional_error.txt | 6.7 KB | jitendrapurohit |
| #3 | webform_3032336.patch | 790 bytes | sammuell |
| #2 | Screenshot form.png | 10.68 KB | sammuell |
| #2 | Screenshot conditions.png | 16.76 KB | sammuell |
| #2 | Screenshot components.png | 19.49 KB | sammuell |
Comments
Comment #2
sammuell commentedComment #3
sammuell commentedWhen updating the required state in webform.js checkboxes are generally excluded in the respective selector (see attached patch file). If checkboxes are included in the selector it works as intended. However, I don't know if checkboxes have simply been forgotten or excluded on purpose.
Comment #4
liam morlandComment #5
liam morlandComment #6
sammuell commentedI'm wondering why the current implementation specifically lists some input types. Looking at the referenced issue I think it would make sense to simplify.
var $targetInputElements = $target.find("input,textarea,select");Comment #7
liam morlandThe problem only appears in cases were there is just one checkbox. Otherwise, @required is not set anyway.
Comment #9
liam morlandThanks for the patch.
Comment #11
jitendrapurohit commentedThis breaks the form when you have a conditional of making the checkbox group required on a radio click.
With this patch applied, the form isn't submitted unless we check ALL the checkboxes present in the group. I've attached a simple webform to replicate this usecase.
- Select radion button "Yes" to make the checkbox attribute required.
- Enable one of the checkbox and submit the form. It displays a validation error to enable all the checkboxes.
Comment #12
liam morland@#11: I think what you are reporting is already reported in #3100921: Multiple value select options requiring all boxes be checked.