Hidden row weights on conditional fields cause error

Created on 31 March 2021, almost 4 years ago
Updated 29 September 2023, over 1 year ago

Problem/Motivation

When setting up a form with conditional fields, I often encounter the following error, with no explicit message being displayed on the page :
An illegal choice has been detected. Please contact the site administrator.

Along with the following log :
Illegal choice -7 in Weight for new rule group element.

This error seems to be produced by the row weight being selected automatically to an illegal value whilst being hidden by default : displaying the row weight shows the line weight for the "new condition" line circled in red, indicating that this is what caused the error.

This error is hidden by default, which is pretty confusing for the user.

Steps to reproduce

  1. Create a new webform
  2. Insert two new radio buttons fields (for example)
  3. Insert two new text fields (also for example)
  4. Go to conditional fields. Set up two conditional fields, each controlling the display of one text field based on the value of one radio field.
  5. Click on save, get the error. The error is hidden, the message doesn't explicitly say what's going on.
  6. Click on "show line weights" : the "new line" box is circled in red.

Proposed resolution

I would suggest either making sure the automatically selected weight the new line is set to a legal value, or making sure the displayed message leads the user to understand the problem is with line weights.

🐛 Bug report
Status

Closed: cannot reproduce

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024