SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot maxdream01's Avatar
    Join Date
    Feb 2011
    Location
    USA
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text Box retain inputed value

    how do you get a textbox in a form to retain an inputed value after that form is submitted

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to grab the incoming POST data and refill the form, can't do it with Javascript as far as I know. If you were sending the form using a GET you could but sending form data, especially text areas, via a GET can be very problematic.

  3. #3
    SitePoint Zealot maxdream01's Avatar
    Join Date
    Feb 2011
    Location
    USA
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i were to do that would the data saved be unique for each user of the site, also can i assign the value a variable and then after the submit rewrite the variable in the textbox (though i don't know if that would be unique per user).

  4. #4
    SitePoint Addict bronze trophy AllanP's Avatar
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    298
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You need to save the information that you want to view on returning to the form page. This can be done in several ways.
    1: transfer the data string in the search component of the outging and incoming
    URL ...?abcde. You can then retrieve it when the incoming page loads.
    2: make your form page part of a frameset with the left column of the frameset hidden. You do this with cols="*,100%". The form page then fills the viewport completely but you can still save info to the hidden column. This is available as soon as the main page is re-loaded into the other part of the frameset.
    3: Store the info in a cookie. Some people may have cookies turned off.

    Once the incoming page is loaded you can take the saved data and re-populate the form.

  5. #5
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    simply put
    onclick="return function1()"
    to the submit button tag


Bookmarks

Posting Permissions

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