In Drupal 7, errors for file_managed field remain even when fixed
-
12-12-2019 - |
Question
I've been beating my head over this one and can't figure out how to solve it.
I have a content type with an image field, and I've set minimum dimension requirements for the field. The form to create or edit nodes of this type includes a field of type "managed_file" to deal with the upload of images. When an image is upload and it does not meet the minimum dimension requirements, a nice error message is added via ajax that reads "The specified file xxx could not be uploaded. The image is too small; the minimum dimensions are 150x150 pixels." This is great.
When I then upload a file that does fit all requirements, however, the error message remains.
Is this a bug in Core? Is there a good way to remove error messages in this situation when they are no longer relevant?
Thanks for any help!
Solution
This is a known issue (File validation error message not removed after subsequent upload of valid file - 1792032). A patch exists for Drupal 8 and that same patch should apply cleanly to Drupal 7. The issue is waiting on somebody to write tests before it can be RTBCd.
UPDATE: This patch has been committed to Drupal 8. Waiting on a backport to Drupal 7.
OTHER TIPS
The error message isn't supposed to appear when the file fits.
Try to push your limits a bit further or upload another file that is below your restrictions by some margin.
And kindly tell me how things went.
Muhammad.