SmartZoos / Toolset

Gaming platform for SmartZoos project
MIT License
0 stars 1 forks source link

Activity item forgets images on error in creation #200

Closed kaimikael closed 6 years ago

kaimikael commented 6 years ago
  1. Create an activity item.
  2. Skip the title box.
  3. Select a question type which lets you display images.
  4. Add images to the answer alternatives.
  5. Press Save. There will be an error message that you have to supply a title, but even if you do so, all the images you uploaded will have been lost, so you have to reupload them. This is not specific to a missing title, but any error during Save will cause the images to go missing.
pjotrsavitski commented 6 years ago

This is a normal behaviour, any files attached to the form would be reset after submission (even if that one fails). The temporary uploaded version of the file would be removed.

The only way would be to do that over AJAX, but that would be a noticeable change.

kaimikael commented 6 years ago

Can we then at least add a warning that any images have to be re-added?

pjotrsavitski commented 6 years ago

Would need to check if that could be easily adde into the flow, but should be doable.

kaimikael commented 6 years ago

Should just require additional text to the error message given, I think.

pjotrsavitski commented 6 years ago

System needs to detect that images file was present, validation failed and file has been removed. Then make sure to notify the form about that. Then the message would be shown.

This is just from the top of my head without consulting with the codebase.

But in essence, yes, something like that.

kaimikael commented 6 years ago

Oh, I could imagine something as simple as: “If you had added any pictures, you have to add them again. Sorry.”

pjotrsavitski commented 6 years ago

Well, seems that your solution is way better. It does not have to make the checks for picture being present. Just the one for the validator. If any issues are present, then show the message.

This would be way easier and faster to implement.

Simple does not seem to be my thing, especially in the evening.

Do let me know if the simple solution is fine by you.

kaimikael commented 6 years ago

Oh, absolutely. We can add refinements later on, as and when there is time. One such solution I was thinking of—would it be possible to deactivate the Save button until all mandatory fields have been filled in?

pjotrsavitski commented 6 years ago

That is possible, but validation could bark on more things than just missing value. A few examples would be: unacceptable image format and value that does not comply to the validator logic.

We will start small and see where it gets us.