Welcome Guest, Not a member yet? Register   Sign In
How to restore file_upload value on error?
#1

[eluser]James Spibey[/eluser]
Hi,

I'm trying to figure out the best way to retain the value of a file upload field between postbacks of a form. The problem I have is that the field isn't 'required' and so if they post a form and it fails validation, it isn't clear that they need to upload the file again.

Has anyone come across this?

Cheers

James
#2

[eluser]xwero[/eluser]
you could check if a file was uploaded and on error you could highlight the file field to make sure people add the upload again.
#3

[eluser]ejangi[/eluser]
spib, it's important to note that file upload fields don't have a value="" attribute, so you can't repopulate it. xwero's suggestion is spot on and probably the best way for you to keep users from getting too confused.
#4

[eluser]James Spibey[/eluser]
Thanks guys. In the end I did pretty much as suggested but also added a banner at the top of the page explaing that they need to re-select the file to upload




Theme © iAndrew 2016 - Forum software by © MyBB