Problem separating request.form("value") from record ID

Discussion in 'ASP General' started by David, Jan 28, 2008.

  1. David

    David Guest

    Hi,

    I have an asp page which lists records.
    Each record has an ID appended to it.
    On the following edit page, I am trying to test against a certain
    field value, if it is >0 then run the update, otherwise don't. The
    problem is the data for testing is as follows:

    Dim arrMetal
    Dim iLoop
    arrMetal=split(request.form("ID"), ", ")


    For iLoop=0 to Ubound(arrMetal)

    IF request.form("del_qty_" & arrMetal(iLoop)) > 0 THEN

    Where del_qty is a number entered in the form, and arrMetal(iLoop) is
    the records ID whilst in the loop on the edit page. When I try the
    above if statement I get an error:

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: '[string: ""]'

    If I response.write request.form("del_qty_" & arrMetal(iLoop)), then I
    get just the qty value without the ID printing.
    How can I re-write my if statement to test the qty value ??? I have
    tried using SPLIT on "_" but still the same .
    I tried just request.form("del_qty"), but this gives me nothing.

    Appreciate your help. I know why the error is there, but i'm not sure
    how to get around it ?

    Thanks

    David
     
    David, Jan 28, 2008
    #1
    1. Advertising

  2. David wrote on Mon, 28 Jan 2008 09:37:14 -0800 (PST):

    > Hi,


    > I have an asp page which lists records.
    > Each record has an ID appended to it.
    > On the following edit page, I am trying to test against a certain field
    > value, if it is >0 then run the update, otherwise don't. The problem is
    > the data for testing is as follows:


    > Dim arrMetal
    > Dim iLoop arrMetal=split(request.form("ID"), ", ")


    What does request.form("ID") contain? Does every single record in your HTML
    have an "ID" form field? If so, you can use the For Each statement instead,
    but I can't provide example code without your HTML.

    > For iLoop=0 to Ubound(arrMetal)


    > IF request.form("del_qty_" & arrMetal(iLoop)) > 0 THEN


    > Where del_qty is a number entered in the form, and arrMetal(iLoop) is
    > the records ID whilst in the loop on the edit page. When I try the
    > above if statement I get an error:


    > Microsoft VBScript runtime error '800a000d'


    > Type mismatch: '[string: ""]'


    Which suggests that the form field doesn't exist, or is empty. You can't go
    comparing a string to a number like that if the string can't be recast to a
    numeric value.

    > If I response.write request.form("del_qty_" & arrMetal(iLoop)), then I
    > get just the qty value without the ID printing.


    Why do you think the ID would be printed? You have nothing in that line
    printing the ID value out.

    > How can I re-write my if statement to test the qty value ??? I have
    > tried using SPLIT on "_" but still the same .
    > I tried just request.form("del_qty"), but this gives me nothing.


    > Appreciate your help. I know why the error is there, but i'm not sure
    > how to get around it ?


    At a guess there is a problem with the way the field names are generated in
    the HTML itself, such that at some point in the looping there is no value
    for the quantity.

    If you can include a copy of the code that generates the rows in the HTML
    I'll see if I can suggest a way to get what you need.

    --
    Dan
     
    Daniel Crichton, Jan 29, 2008
    #2
    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. Christian H
    Replies:
    1
    Views:
    882
    Natty Gur
    Jul 29, 2003
  2. Chumley the Walrus

    Separating form elements on aspx page

    Chumley the Walrus, Aug 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    385
    Eliyahu Goldin
    Aug 3, 2004
  3. David
    Replies:
    3
    Views:
    116
    David Gordon
    Aug 4, 2004
  4. norton
    Replies:
    4
    Views:
    237
    Dave Anderson
    Aug 13, 2004
  5. Replies:
    7
    Views:
    181
    Evertjan.
    Jun 22, 2006
Loading...

Share This Page