I'm working on a D8 project and I have a webform where I use webform_address type fields.

If the country (which is a mandatory field) in those fields is empty I'm getting the generic error "An illegal choice has been detected. Please contact the site administrator.".

Is there any way to change it?

I tried to use the hook_webform_element_alter in order to add custom validation in my field but the country is a subfield of address field.

Any thought/idea/solution would be valuable!

Thank you in advance.

  • Sounds like a bug. Please isolate the problem, document how to replicate it, and create an issue in the Webform issue queue. (drupal.org/project/issues/webform?version=8.x)
    – jrockowitz
    Aug 29, 2017 at 22:40
  • Thank you @jrockowitz. I will do it now. For now, a workaround was to switch the country to dropdown.
    – Ismini
    Sep 7, 2017 at 8:44
  • Actually, after some extra testing today, I realised that after the latest module update, I had to change manually all they address fields (alter the country to textfield) and works fine. So I won't add it as a bug
    – Ismini
    Sep 7, 2017 at 9:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.