Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Losing Form data

    Hi Matthew,

    Changes made to your listbox items at the client-side won't be automatically
    persisted to the server. You will need to write some additional code to make
    this happen (ie. posting the list of items in a hidden-form field, parsing
    it at the server and updating the Items collection accordingly).

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    [url]http://obies.com/vga/blog.aspx[/url]

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    and not by private mail.
    "Matthew C" <dotnet@noveris.com> wrote in message
    news:SYkKa.12090$C83.1180465@newsread1.prod.itd.ea rthlink.net...
    > Hello All,
    >
    > I have two List Boxes on one page, one list box is a populated server-side
    > from a data source, the other is initially empty. The page then allows
    the
    > user to move data from the first box to the second (empty) list box via a
    > client-size JavaScript.
    >
    > Once the second box has data in it, the user submits/posts and a
    server-side
    > function attempts to read the data.
    >
    > PROBLEM: The data (in the second box) that is populated through the
    > client-side JavaScript is not persistent and does not make it to the
    server.
    > The first box maintains its data through postings, but the second box
    loses
    > all data.
    >
    > Any help is greatly appreciated.
    >
    > cheers
    >
    > Matthew
    >
    >
    >

    Victor Garcia Aprea [MVP] Guest

  2. Similar Questions and Discussions

    1. Losing Data
      I'm using coldfusion MX6.1 and usign MS Access 2003 as a database program. We run web survey for class every semester and we had problem reported...
    2. Losing Data Sourxe
      Hi Guys Help me My new coldFusion server was working fine for 12 days from yesterday I got this error message: Data source CodaData...
    3. Losing mysql connection between form invocations
      I'm trying to : 1. display a form to get a user's mysql logon information 2. logon the user to the mysql database, using the informaton gathered...
    4. [PHP] SESSION variables losing data on WinXP?
      I believe all pages in your site are protected by session variables. Try to login first, then go where you want to go. Or try to remark codes which...
    5. Session Losing Data
      Edwin, The directory being "moved" is really a directory being renamed that contains an image file that was just uploaded to a temporary directory....
  3. #2

    Default losing form data

    i am validating form data, but when i redirect the user back to the
    form page to correct the errors, all of the data they entered has
    disappeared.

    Please Help.

    Thanks
    digihoo Guest

  4. #3

    Default Re: losing form data

    digihoo wrote:
    > i am validating form data, but when i redirect the user back to the
    > form page to correct the errors, all of the data they entered has
    > disappeared.
    The browser only displays what you send.
    If you want to send the same data a user submitted, you have to save it
    between the form processing script and the script that outputs that
    form. I'd do that with session variables:

    <?php // form processing script
    session_start();
    if (isset($_POST['userdata']) {
    validate_data($_POST); // define according to your needs
    $_SESSION['userdata'] = $_POST['userdata'];
    }
    header('Location: form_output.php');
    exit('Redirected <a href="form_output.php">here</a>.');
    ?>

    and

    <?php // form output script
    session_start();
    if (isset($_SESSION['userdata']) {
    $useradata = $_SESSION['userdata'];
    } else {
    $userdata = ''; // or some other default value
    }
    ?>
    <form method="post" action="form_process.php">
    <input type="text" name="userdata" value="<?php echo $userdata; ?>" />
    <input type="submit">
    </form>



    Happy Coding :-)

    --
    I have a spam filter working.
    To mail me include "urkxvq" (with or without the quotes)
    in the subject line, or your mail will be ruthlessly discarded.
    Pedro Guest

  5. #4

    Default Re: losing form data

    i should have been more specific here. the form also loses its data if
    the user just clicks the back button - without actually submitting the
    data.

    when they click forward to the form again, the data is also gone.

    i was told that this is caused by a bug in IE 6, and to put:

    header("Cache-control: private");

    in the code before any HTML. however, this didn't solve the problem.

    is there a way to prevent form data from disappearing, whether or not
    it has been submitted into post variables?

    Thanks
    digihoo Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139