Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Unless I'm missing an option somewhere in the configuration, there doesn't appear to be an option to limit the number of allowed values for a field. I have the requirement to allow users upload multiple files to one field in a form, but limit it to no more than 3. I can't see an option for that - I can either have the "multiple" checkbox unchecked which limits it to just 1 entry, or have "multiple" checked, in which case there doesn't seem to be a limit.
Would there be any way to add this functionality? Thanks
Comment | File | Size | Author |
---|---|---|---|
#18 | ability_to_limit_the-2854879-18.patch | 53.03 KB | jrockowitz |
| |||
#15 | ability_to_limit_the-2854879-15.patch | 34.77 KB | jrockowitz |
#12 | ability_to_limit_the-2854879-11.patch | 33.7 KB | jrockowitz |
#7 | ability_to_limit_the-2854879-7.patch | 28.94 KB | jrockowitz |
#5 | Screen Shot 2017-02-22 at 8.49.45 PM.png | 239.76 KB | jrockowitz |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedRight now, #multiple only support TRUE (1) = UNLIMITED VALUES or FALSE (0) => ONE VALUE.
At some point I want to extend #multiple to support limits (ie > 1). It would required updates to the webform element UI and a new validation handler.
It is a medium amount of work and is now on the immediate roadmap.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI need to see if this patch breaks anything and then I will write some tests.
Below is a preview of the change.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #15
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #18
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #19
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedPlease review the attached patch which is finally complete and passing all tests.
Comment #21
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download and review the latest dev release.