Value just contiues (commaseparated?)

Discussion in 'ASP General' started by jodleren, Nov 13, 2009.

  1. jodleren

    jodleren Guest

    Hi all

    In a form, I have some hidden values, which once set stays forever.
    There is an ignore option, and I keep it, as it might be needed later.
    If is default false (<>"true"), that works well.
    Just before </from> I set the value.
    In 2 places, there is a small script, which can set the value to true.
    But the problem is, that it just "grows", second time it is not
    "false" but "false, false", and it just gets longer.

    Why?

    WBR
    Sonnich

    Code:

    response.write request("ignore_mf") & "<br>"
    bIgnoreMissing=safe_str(request.form("ignore_mf")) = "true"
    request.form("ignore_mf")="" ' does not help
    request.form("ZipError")=""
    response.write "bIgnoreMissing= " & cstr(bIgnoreMissing) & "<br>"

    ......
    <form...><%
    if bIgnoreMissing then
    %><input type="hidden" name="ignore_mf" value="true"><%
    else
    %><input type="hidden" name="ignore_mf" value="false"><%
    end if
     
    jodleren, Nov 13, 2009
    #1
    1. Advertising

  2. jodleren

    jodleren Guest

    On Nov 13, 8:42 pm, jodleren <> wrote:
    > Hi all
    >
    > In a form, I have some hidden values, which once set stays forever.
    > There is an ignore option, and I keep it, as it might be needed later.
    > If is default false (<>"true"), that works well.
    > Just before </from> I set the value.
    > In 2 places, there is a small script, which can set the value to true.
    > But the problem is, that it just "grows", second time it is not
    > "false" but "false, false", and it just gets longer.
    >
    > Why?
    >
    > WBR
    > Sonnich
    >
    > Code:
    >
    > response.write request("ignore_mf") & "<br>"
    > bIgnoreMissing=safe_str(request.form("ignore_mf")) = "true"
    > request.form("ignore_mf")=""  ' does not help
    > request.form("ZipError")=""
    > response.write "bIgnoreMissing= " & cstr(bIgnoreMissing)  & "<br>"
    >
    > .....
    > <form...><%
    > if bIgnoreMissing then
    >   %><input type="hidden" name="ignore_mf" value="true"><%
    > else
    >   %><input type="hidden" name="ignore_mf" value="false"><%
    > end if


    And this does not set it?

    <input type="submit" name="Submit" value="Continue anyway"
    class="button2"
    onClick="document.forms[0].elements
    ['ignore_mf'].value='true';">

    It is java, so it does not belong here. But I guess the problem is
    related to my commaseparated text?

    WBR
    Sonnich
     
    jodleren, Nov 13, 2009
    #2
    1. Advertising

  3. jodleren

    Evertjan. Guest

    jodleren wrote on 13 nov 2009 in microsoft.public.inetserver.asp.general:


    > <%
    > bIgnoreMissing = safe_str(request.form("ignore_mf")) = "true"
    > if bIgnoreMissing then
    > %><input type="hidden" name="ignore_mf" value="true"><%
    > else
    > %><input type="hidden" name="ignore_mf" value="false"><%
    > end if
    > %>



    Why not the far more readable:

    <%
    if safe_str(request.form("ignore_mf")) = "true" then
    bIgnoreMissing = "true"
    else
    bIgnoreMissing = "false"
    end if
    %>

    <input type='hidden' name='ignore_mf' value='<% = bIgnoreMissing %>'>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 13, 2009
    #3
  4. jodleren

    jodleren Guest

    On Nov 14, 12:31 am, "Evertjan." <>
    wrote:
    > jodleren wrote on 13 nov 2009 in microsoft.public.inetserver.asp.general:
    >
    > > <%
    > > bIgnoreMissing = safe_str(request.form("ignore_mf")) = "true"
    > > if bIgnoreMissing then
    > >   %><input type="hidden" name="ignore_mf" value="true"><%
    > > else
    > >   %><input type="hidden" name="ignore_mf" value="false"><%
    > > end if
    > > %>

    >
    > Why not the far more readable:
    >
    > <%
    > if safe_str(request.form("ignore_mf")) = "true" then
    >     bIgnoreMissing = "true"
    > else
    >     bIgnoreMissing = "false"
    > end if
    > %>
    >
    > <input type='hidden' name='ignore_mf' value='<% = bIgnoreMissing %>'>


    Well, that did not explain my problem :)
     
    jodleren, Nov 16, 2009
    #4
  5. jodleren

    Evertjan. Guest

    jodleren wrote on 16 nov 2009 in
    microsoft.public.inetserver.asp.general:

    > On Nov 14, 12:31 am, "Evertjan." <>
    > wrote:
    >> jodleren wrote on 13 nov 2009 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > <%
    >> > bIgnoreMissing = safe_str(request.form("ignore_mf")) = "true"
    >> > if bIgnoreMissing then
    >> >   %><input type="hidden" name="ignore_mf" value="true"><%
    >> > else
    >> >   %><input type="hidden" name="ignore_mf" value="false"><%
    >> > end if
    >> > %>

    >>
    >> Why not the far more readable:
    >>
    >> <%
    >> if safe_str(request.form("ignore_mf")) = "true" then
    >>     bIgnoreMissing = "true"
    >> else
    >>     bIgnoreMissing = "false"
    >> end if
    >> %>
    >>
    >> <input type='hidden' name='ignore_mf' value='<% = bIgnoreMissing

    > %>'>
    >
    > Well, that did not explain my problem :)


    It was not ment to do.

    Which shows that a usenet NG is not a paid helpdask.

    However I urge you to pay[ ;-) ] attention,
    as readable programming surfaces otherways obscure errors.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 16, 2009
    #5
  6. jodleren

    Dan Guest

    "jodleren" <> wrote in message
    news:...
    > Hi all
    >
    > In a form, I have some hidden values, which once set stays forever.
    > There is an ignore option, and I keep it, as it might be needed later.
    > If is default false (<>"true"), that works well.
    > Just before </from> I set the value.
    > In 2 places, there is a small script, which can set the value to true.
    > But the problem is, that it just "grows", second time it is not
    > "false" but "false, false", and it just gets longer.
    >
    > Why?
    >
    > WBR
    > Sonnich
    >
    > Code:
    >
    > response.write request("ignore_mf") & "<br>"
    > bIgnoreMissing=safe_str(request.form("ignore_mf")) = "true"
    > request.form("ignore_mf")="" ' does not help
    > request.form("ZipError")=""
    > response.write "bIgnoreMissing= " & cstr(bIgnoreMissing) & "<br>"
    >
    > .....
    > <form...><%
    > if bIgnoreMissing then
    > %><input type="hidden" name="ignore_mf" value="true"><%
    > else
    > %><input type="hidden" name="ignore_mf" value="false"><%
    > end if
    >



    Can you post the code without snipping? I'm guessing that the cause of the
    problem has been snipped out.

    If you keep getting values appended like that, then it's normally caused by
    having 2 fields of the same name, each with one of the values. So, for
    instance, you have the code above which writes out a hidden field called
    ignore_mf and sets it to either true or false, which is fine. But if you
    have another hidden field called ignore_mf in the same form, which just has
    the value from request.form written into it (maybe you have this for
    debugging or testing), then the browser will send both hidden fields, and
    the result is the values appended to each other with a comma between them
    (because that's how ASP stuffs multiple fields with the same name into a
    single value).

    I'd suggest you view the source of your form, and look for any duplicated
    ignore_mf fields. If you have multiple forms on one page, make sure you have
    closed each correctly. Maybe you have more than one form, each has an
    ignore_mf field, and because you've omitted a </form> tag they're being
    treated as one form (or you've made a HTML error that causes the </form> to
    be ignored because it's in the wrong place - use a HTML validator to check
    for this).

    --
    Dan
     
    Dan, Nov 16, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Garma

    Just value copied?

    Garma, Jan 16, 2004, in forum: C Programming
    Replies:
    10
    Views:
    582
    Joe Wright
    Jan 17, 2004
  2. Frank Bechmann

    just another default argument value gotcha

    Frank Bechmann, Dec 29, 2003, in forum: Python
    Replies:
    3
    Views:
    409
    Frank Bechmann
    Dec 29, 2003
  3. walterbyrd
    Replies:
    1
    Views:
    381
    Damjan
    Apr 10, 2006
  4. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C++
    Replies:
    24
    Views:
    771
    Lionel B
    Jul 16, 2007
  5. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C Programming
    Replies:
    42
    Views:
    1,147
    user923005
    Jul 17, 2007
Loading...

Share This Page