Hi Theodoulos,
This is a default behavior when backend validation kicks in: form is submitted actually (POST request happens) then model state in FormWidgetController returns false for validation and the system re-draws the form with fields prepopulated. The problem is that the default file upload control cannot pre-populate file selected again.
To solve this you have two options (but both to be honest are not very easy to accomplish):
- Customize form validation to use frontend validation instead of backend (will require you writing some custom JS)
-
Develop your own file upload control that will support pre-population on validation exception:
- it could be frontend control which when user selects the file actually posts the file to server straight away and stores file ID in the control
- in this case file ID will remain the same on validation exception and file uploaded will remain the same
- you would need to deal with re-uploading this file and data cleanse at least