- Issue created by @dieterholvoet
- Status changed to Needs review
about 1 year ago 1:01pm 22 August 2024 - π¨π¦Canada Liam Morland Ontario, CA π¨π¦
Did you check where the other values get set? It seems odd that some get set and some do not. Perhaps there is other code that could be fixed or that could be removed due to this change.
Please rebase onto 6.3.x.
- π§πͺBelgium dieterholvoet Brussels
Did you check where the other values get set? It seems odd that some get set and some do not.
It seems like some parts of the code such as validation handlers just don't have access to the values. If there's no validation standing in the way, these values are stored just fine. Now I'm encountering the same or at least a similar issue with file uploads.
Submitting fid's to a multiple file element works when formatted this way, values are stored correctly:
-----------------------------417014635139932088931531491267 Content-Disposition: form-data; name="documents[]" 98 -----------------------------417014635139932088931531491267 Content-Disposition: form-data; name="documents[]" 97 -----------------------------417014635139932088931531491267
But once you make the element required, it'll start complaining about missing values, blocking submission. The only way I have found to submit a file to a required file element, is if it only accepts a single value and if it's formatted this way:
-----------------------------417014635139932088931531491267 Content-Disposition: form-data; name="documents[fids]" 98 -----------------------------417014635139932088931531491267
To give some context: I'm encountering this issue while working on the Webform Headless module β . There's a
/webform/{webform}/json/submission
API endpoint that allows you to create submissions, returning any validation errors in a structured JSON format. TheDrupal\webform_headless\Submitter::createSubmission()
method is for the biggest part copied from theDrupal\webform\WebformSubmissionForm::submitWebformSubmission()
method, with the workaround from the MR in this issue added. That workaround doesn't seem to fix the issue (completely) though. - π§πͺBelgium dieterholvoet Brussels
In case of the file upload, the method that doesn't have access to the value and which is setting the error is
Drupal\file\Element\ManagedFile::validateManagedFile()
. - Status changed to Postponed: needs info
13 days ago 5:00pm 8 September 2025 - πΊπΈUnited States jrockowitz Brooklyn, NY
We need to document the issue with some example code with an example webform that attempts to programmatically create webform submission and fails using something like
\Drupal\webform\WebformSubmissionForm::submitFormValues