Required attribute for unlimited values field doesn't stay required

Created on 24 April 2025, 9 days ago

Problem/Motivation

At the initialization of the form, the required field is hidden and become visible only if certain radio button is clicked. The multi values fields set as required loose the "required" attribute when "add" or "+" is clicked to add another item.
While I have lots of contrib and custom modules on my application, this behavior is still present on fresh/minimal install on simplytest.me Webform 6.2.9 on Drupal 10.4.3.

Steps to reproduce

  1. Import the existing webform configuration attached. Than go to view webform
  2. Select "New assessment" from the radios
  3. select one of the first 2 Production type radios. At this point the required field attr and label (*) is present
  4. Select "Add" or "plus sign" to add another item. Now the required field attr and label (*) disappear.

However, if you chose the third option at the step 3, than select back one of the first 2, the required field attr and label is back again.


My guess is that the field is not loaded correct at the build phase. Kint doesn't show up "required=true" for that field. If I hardcode "required=true" for the field, it's working as intended.

Thank you,
Ionut

🐛 Bug report
Status

Active

Version

6.2

Component

Code

Created by

🇨🇦Canada ionut_ottawa

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

Comments & Activities

Production build 0.71.5 2024