Occasionally does not work in AJAX form

Created on 15 December 2020, almost 4 years ago
Updated 10 April 2023, over 1 year ago

Problem/Motivation

Occasionally, the plupload form element fails to populate its $form_state value with information about uploaded files, if the form it appears in has been loaded with AJAX. This is caused by a small bug in the fix from #2645658: Wrong regular expressions when processing file input . Specifically, if the element's unique (randomly generated) ID contains a '-' character, it fails to be matched by this regular expression.

Steps to reproduce

  1. Create an AJAX form containing a plupload element.
  2. Submit the form repeatedly, causing it to be reloaded with AJAX, until the plupload element's random ID contains a '-' character (following the '--' that always precedes the random ID).
  3. Attach a file to the plupload element and submit the form.

Expected result: $form_state->getValue('your_plupload_element') contains information about the attached file.
Actual result: $form_state->getValue('your_plupload_element') is empty.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024