Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hidden fields losing data

    Has anybody got any experience of request.form only bringing back part of the data from a hidden form field?
    I am using 'old fashioned' asp (not net) to create a page that calls itself. Each time the form is used the user has the option to enter some data. This data is put into some hidden fields using JavaScript. When the page is called, it checks the hidden fields. If it finds anything, it creates new visible fields on the page's form. In this way the users can gradually build up all the fields they need on the form.
    It basically works, but after a couple of times through the process something somewhere is trimming the data so that the prompts next to the new fields lose everything after the first space. For example, Test One, Test Two and Test Three all become Test.

    Do hidden fields need to contain URL encoded text?
    If so, is there a function somewhere to convert URL encoded text back to normal text?

    Ian

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Hidden fields losing data

    > Do hidden fields need to contain URL encoded text?
    I didn't think so.

    > If so, is there a function somewhere to convert URL encoded text back to normal text?
    The Server object has the relevant functions should you wish to experiment.

    Is it possible that there is a problem in your ASP page's VBScript code that is causing the VALUE attribute to have incomplete data?

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hidden fields losing data

    I can't find anything wrong with the code, which is why I'm looking at other posibilities. There might be a bug there, but I can't see it.
    I also can't find a complementary method to Server.URLEncode, to un-encode something that has been URL encoded. Are you sure that there is one?

    Ian

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Hidden fields losing data

    Oh, I was having a bad day. <img src=/S/blush.gif border=0 alt=blush width=15 height=15> First, I was thinking of HTMLEncode, which is what I have been using, and second, I do not see a decode method.

    To convert URL-encoded strings, you will need some kind of parsing code that replaces %nn with the appropriate character. This could be a project for Andrew77 and regular expressions, but I'd probably use a loop, something like this:

    Do
    ' Look for a % sign in the string and stop looking when there are no more
    intPos = InStr(1, strCoded, "%")
    If intPos = 0 Then Exit Do
    ' Do a mid-string replace of the three characters starting at intPos with a character
    ' ==> Someone needs to write this code, someone whose stomach isn't growling for lunch
    ' or maybe it's out there on the web, ready and waiting?
    Loop

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hidden fields losing data

    quick question - are you wrapping the value in the hidden fields with ' or "? if you don't wrap the value with ' (at least) your value data will drop after the first space in the text. (If you are writing field values to a db be aware of the potential problem of using an ' character for writing to SQL Server.)

Posting Permissions

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