file input values

Discussion in 'HTML & Website Design' started by Jamie18, Sep 17, 2007.

  1. #1
    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>
    
    Code (markup):
     
    Jamie18, Sep 17, 2007 IP
  2. litebulb1

    litebulb1 Peon

    Messages:
    151
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what you are looking for is called sticky forms.
     
    litebulb1, Sep 17, 2007 IP
  3. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #3
    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.
     
    krt, Sep 17, 2007 IP
  4. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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
     
    AstarothSolutions, Sep 18, 2007 IP
  5. Mooseman

    Mooseman Peon

    Messages:
    453
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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
     
    Mooseman, Sep 18, 2007 IP
  6. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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
     
    Jamie18, Sep 18, 2007 IP