Adding an address composite to a webform and choosing the state element to be of textfield, still throws out the "An illegal choice has been detected. Please contact the site administrator." error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hanoii created an issue. See original summary.

hanoii’s picture

Status: Active » Needs review
FileSize
768 bytes

I tracked this down to the fact that if an element has both '#options' and '#value' drupal attempts to validate the same way (performRequiredValidation()).

An odd thing about this is that this didn't happen before, only on my latest batch of updates (webform-beta12 to beta 15 and core 8.3.4 to 8.3.5) so not sure if the root of this is a change in core or something else.

Anyhow, attach is a patch that sorts this out by removing '#options' on textfields. Not sure if you'll like this approach but so I couldn't think of a better way of fixing this.

On the other hand, I don't think it's a harmful patch either.

  • jrockowitz committed fac8be5 on 8.x-5.x authored by hanoii
    Issue #2893622 by hanoii: An illegal choice has been detected on Address...
jrockowitz’s picture

Status: Needs review » Fixed

Thanks for the patch

Status: Fixed » Closed (fixed)

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