Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    285
    Provided Answers: 1

    Unanswered: File input clears after back button clicked

    Good day,

    I have an asp page with a few textboxes on it as well as a file input box that I use to save the file location of a file. Everything is working well except that should they click the button to submit the form and want to change a value in one of the boxes and click the browsers back button the input file box is cleared but everything else retains there value. Is there anyway to make the browser retain the value entered in the input file box?

    Please help, thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I don't like the fact you're allowing your users to go back and re-submit the same data...

    Often you will find that one page submit, the controls will be cleared, and perhaps the values are stored in a session variable to be loaded on page open...
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    Posts
    285
    Provided Answers: 1
    Sorry really bad explanation. I have checks that when they submit the form if certain fields are empty it will tell them and they need to click the back button and then go and enter in values. Now if they have selected a file in the file input box and left one of the other fields empty when they click the back button to enter a value the file input box is cleared but the rest of the fields that had values in them, textboxes, listboxes and combo's, retain their values. I am trying to make sure the file input box retains its value as well.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    When it comes to form validation, generally you want to use something that runs client side (e.g. JavaScript); so that the users don't submit the form incurring another http request.

    If javascript is not your bag, then instead of telling your users to use the back button; they should click a link back the to page that you supply; or better yet you redirect them back!

    Then the technique mentioned beforehand (storing and retrieving values from session variables) will be your friend.

    Hope this helps
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •