Skip to content

Task form: Show text input for files if previously used #1626

Open
@MrSerth

Description

@MrSerth

When creating or updating a task, we run several validations before storing the user data. When an error occurs, we don't save the requested changes, but rather render the input form again with an error message clearly showing the issues.

However, when we render this form again, the "alternative input" for files is shown by default, rather than the otherwise usual ACE editor used for textual input. In contrast to the textual input, the "alternative input" shows a file picker, allowing users to select a file from the local file system to upload.

The issue is that the form switches to the alternative input on validation errors, even when the standard textual input was used before. We should improve this behavior and still ensure that uploading a binary file works, even with validation errors.

Steps to reproduce:

  1. Go to https://codeharbor.openhpi.de/tasks/new
  2. Add a new file
  3. Only enter some value in the file content editor
  4. Save the task
  5. See the validation errors as expected. Now, move to the file previously added. You'll notice that the editor is gone and a file picker is present.
  6. Clicking on "Toggle file upload/editor" will show the editor again and also include the string previously entered for the new file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions