Skip to content

[LiveForm] Files cleared when form error #2625

Open
@akyoscommunication

Description

@akyoscommunication

When submitting a form with a Live Component (live action), if there is an error, we get a 422 response code because the entity is not valid. That’s expected. However, if the form contains a file input, the live_controller.js script clears the submitted files, preventing the user from reselecting them because they are not in the next requests anymore.

We found these three lines (2123-2125), and when commented out, the issue disappears:

for (const input of Object.values(this.pendingFiles)) { input.value = ''; }

We’re not sure if this is a bug or if it serves another purpose. In any case, resetting the form manually isn't necessary because we already call resetForm() in the Live Action, which clears the files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions