Hen Night - Personal Loans - Loan - Loans - Jewish Israel

PDA

View Full Version : file input values


Jamie18
Sep 17th 2007, 12:47 pm
i'm under the impression that this can't be done without doing strange button/ textfield coverups but maybe someone here can shed a bit of light on the issue..

i've been asked to creat a file input that remembers the file name/path after the file has been submitted.. so if the form fails validation the user doesn't have to search their computer for the file again..

i'm assuming this isn't possible due to user privacy issues.. but if it is possible it would be nice if someone told me how

here's a simplified version of what i want in my page

<form action="thispage" method="post">
<input type="file" id="fileInput" <cfif isdefined("fileInput")>inputField="#fileinput#"</cfif>
<input type="submit" value="Load File">
</form>

litebulb1
Sep 17th 2007, 8:17 pm
what you are looking for is called sticky forms.

krt
Sep 17th 2007, 9:31 pm
litebulb1, if you read, he is talking about file input fields only.

Jamie, file input fields cannot have a default value, or any value, to prevent scripts from hiding such a field, filling in a value, and when a user submits a seemingly harmless form, a file uploads without the user realising.

You can display the base name of the uploaded file but that is all.

AstarothSolutions
Sep 18th 2007, 3:37 am
As above, for the security of the user the file input type is exceptionally limited in what can be done with it. I believe you can semi get round issues by using Flash but this obviously isnt an ideal situation

Mooseman
Sep 18th 2007, 3:47 am
Well.. ususally you don't have to search your computer more then once? If it fails and then when you click "browse" it usually displays the last folder you were in anyway? :S

Jamie18
Sep 18th 2007, 6:44 am
thanks everyone, i assumed that was the answer but didn't want to make an ass of myself by saying it couldn't be done and finding out that it could...

it was just a random idea someone had in a meeting yesterday, they were upset because they took the time to search through their computer for the file and than forgetting to choose another option.. i guess i could just add a bit of javascript form validation, that should make everyone happy