This scenario is fairly unique, but maybe others have encountered it.
I have a multi-page form.
On page 1:
- Radio element, options are "A" and "B"
- Radios other element (conditionally visible when B is selected in the first element).

I select B, then select Other and enter text in the other field.
I click to the next page.
I click previous to return to page 1.

When I switch from "B" to "A" and click next, I am given the following error:
"An illegal choice has been detected. Please contact the site administrator."

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dshields created an issue. See original summary.

dshields’s picture

Status: Active » Needs review
FileSize
914 bytes

This seems to get around it, but I'm sure there's a better approach

jrockowitz’s picture

Can you please create an example webform that can be used to replicate this issue?

Status: Needs review » Needs work

The last submitted patch, 2: webform-radios_other_error-3210047-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dshields’s picture

FileSize
5.14 KB

Yup.
I'll try to attach a demo video as well.

dshields’s picture

FileSize
1.23 MB

Here's a video demo of the issue.

Thanks for looking at this!

jrockowitz’s picture

Do you mind checking if you can replicate this issue using the Bartik theme? I am guessing your theme is causing the issue.

dshields’s picture

FileSize
1022.53 KB

I'm afraid I get the very same in Bartik.

jrockowitz’s picture

Status: Needs work » Needs review
FileSize
1.36 KB
5.32 KB

This is a very edge case bug. The attached patch fixes the issue via \Drupal\webform\Element\WebformRadiosOther::valueCallback and tries to document exactly what needs to be fixed.

I am not exactly sure how to write test coverage for this issue but let's first confirm all the tests are still passing.

I have also included an updated test form that debugs what values are being submitted via to the submission.

dshields’s picture

Status: Needs review » Reviewed & tested by the community

Works well for me!

  • jrockowitz authored a255404 on 8.x-5.x
    Issue #3210047 by dshields, jrockowitz: Conditionally hidden radios...

  • jrockowitz authored a255404 on 6.x
    Issue #3210047 by dshields, jrockowitz: Conditionally hidden radios...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed
Webform logo This ticket was completed using Open Collective funds.
Please consider joining the Webform module's Open Collective to help ensure that the Webform module is maintained.
jrockowitz’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.