I wanted to add a file upload element with multiple uploads allowed, but restricted to a certain number (5 files).

When I add the element via Webform UI to my form and define that cardinality, it won't get saved. The help text in the form shows "unrestricted values", also when editing the element, the cardinality is set to unlimited. I could also reproduce that with a text input field as well.

I've found this issue #2871680: A managed_file field with restricted multiple values shows "Unrestricted values" in the help text and first thought, it could be related. It isn't but pointed me into the right direction:

Directly editing the source showed me, that the element's 'multiple' key is saved as boolean: '#multiple: true', When I change the boolean value to a certain number, then the chosen cardinality is respected in the webform (tried both with file upload and text input and worked)

So there's something wrong in the way the #multiple property gets saved to config

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agoradesign created an issue. See original summary.

jrockowitz’s picture

Priority: Normal » Critical
Status: Active » Needs review
FileSize
950 bytes

This is a critical issue because it affects all elements.

jrockowitz’s picture

I am not ready to tag a full release but I think we need to do 8.x-5.0-beta24 (aka 8.x-5.0-beta23-hotifx).

@see http://cgit.drupalcode.org/webform/log/?h=8.x-5.0-beta23-hotfix

  • jrockowitz committed a197022 on 8.x-5.x
    Issue #2924038 by jrockowitz: Cannot restrict cardinality of multiple...
jrockowitz’s picture

Status: Needs review » Fixed
jrockowitz’s picture

agoradesign’s picture

Wow, that's a quick reaction :)

Status: Fixed » Closed (fixed)

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