Closed babanesma closed 7 years ago
The problem here is that browser security does not allow us to pre-select a file in the upload field on page load. So if the form is submitted (i.e. JS validation doesn't stop the page reloading) then it's impossible to set the file when the page is loaded again.
While we can't resolve this issue directly, we could change the functionality to prevent it being a problem: 1) Enhance client-side validation on this form so few/no cases exist where we rely on the form being submitted and the page reloaded. Currently, every basic validation error I'm trying in the from is caught by HTML5/JS so possibly this is close to being the case already?
2) Change the file upload fields to be AJAX file uploads where the file is uploaded at the time its selected (rather than on form submit). This will involve adding a plugin to allow AJAX file uploading.
@babanesma @ahmedelbougha What are your views on this.
@babanesma PR #234 created and assigned to you.
@zhibek
[x] Files are persisted when the validation is failing but the form is never succeeded ( redirected to /organizations listing page ) , it produces other errors shown below
( ! ) Warning: pathinfo() expects parameter 1 to be string, array given in /var/www/html/module/Organizations/src/Organizations/Model/Organization.php on line 391
and
( ! ) Warning: rename() expects parameter 1 to be a valid path, array given in /var/www/html/module/Organizations/src/Organizations/Model/Organization.php on line 396
Although the organization is saved and can be viewed in the list /organizations
[x] Editing any organization ( saved before this change or after ) produces another warning
( ! ) Warning: Illegal string offset 'name' in /var/www/html/module/Utilities/src/Utilities/Service/View/Helper/FormFile.php on line 47