Problem/Motivation

For the conditions added by other modules (e.g. Rules), when the conditions have mandatory contexts with select fields, the switch entities can not be saved due to the following error.
An illegal choice has been detected. Please contact the site administrator.

Steps to reproduce

  1. Install Rules module.
  2. Go to Structure > Switches
  3. Create a new switch.
  4. Select "Manual" Activation Method.
  5. Hit save
  6. The following error is observed

An illegal choice has been detected

Proposed resolution

  • Disable the required validation for fields which are not visible and are mandatory select fields.
  • Assign "#empty_value" attributes to the mandatory select fields
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sushyl created an issue. See original summary.

sushyl’s picture

Issue summary: View changes
FileSize
615.59 KB
sushyl’s picture

sushyl’s picture

Status: Active » Needs review
sushyl’s picture

The previous patch had a regression that was overriding existing values in the form.
Correcting it in a new patch.