Problem/Motivation
Following the changes in #3543014: Make form_file_limit error message configurable, a new global configuration field was added for Default file upload limit per form message.
However, this field is currently set with '#required' => TRUE unconditionally. As a result, administrators attempting to save global element settings (/admin/structure/webform/config/elements) are blocked from saving any changes unless a message is provided—even when no global file upload limit (default_form_file_limit) is configured.
Steps to reproduce
1. Navigate to Structure > Webforms > Configuration > Elements (/admin/structure/webform/config/elements).
2. Ensure Default file upload limit per form is empty.
3. Leave Default file upload limit per form message empty.
4. Attempt to save the form (or alter any unrelated setting, such as CSS classes).
5. Result: Form validation fails with a required field error on Default file upload limit per form message.
Proposed resolution
Update the form definition for default_form_file_limit_message in the configuration form:
1. Remove '#required' => TRUE.
2. Add #states to make the field conditionally required and visible only when default_form_file_limit is filled.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork webform-3612849
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mwilliams.drupalbliss commentedComment #3
aayushpathak commentedworking on it !
Comment #5
aayushpathak commentedI was able to reproduce the issue on a fresh installation.
To fix it, I updated the default_form_file_limit_message form element in WebformAdminConfigElementsForm.php — replacing the unconditional #required => TRUE with a #states condition, so the message field is only required when default_form_file_limit is actually filled. This allows admins to save the global elements configuration without being blocked when no file limit is set.
I've pushed the fix to the issue fork for review. Let me know if any changes are needed!
Comment #6
liam morland