Results 1 to 10 of 10
  1. #1
    Join Date
    May 2004
    Posts
    21

    Unanswered: many textboxes on one page...

    hi!
    Iam creating shopping cart for my self and now Iam stuck with some non-logical problem.
    I have page wich lists all items for each group like

    Mainboard
    -> Abit
    -> Asus
    CPU
    -> Intel
    -> AMD
    ...

    next to each item I have textbox with name txtItem & recordset("id"). In this textbox I need to enter amount of how many items I want to add to my cart. Next to the txtItem I have image button 'add to cart' and I need to read that value from textbox and send it through QueryString for further actions.
    When I've tried to read the value, I get a blank string.

    Dim txt
    txt = Request.Form("txtItem" & recordset("id"))

    It looks logicaly, but doesen't work! what I'm doing wrong?
    thanks
    Last edited by kasic; 10-04-04 at 22:18.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    when you are doing your request are you inside a recordset??? if so I would have thought it would barf because you would end up re-dimensioning txt.

    in other words recordset("id") = "" or null so when you try your request.form etc you are looking for something that doesn't exist.

  3. #3
    Join Date
    May 2004
    Posts
    21
    I forgot to say that this is all inside a recordset in do while loop... so when I Response.Write(recordset("id")) returns valid ID so this is OK, but still wan't work.
    What's the correct way to read the value from such a textbox in do while loop?

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I'd do something like this.....
    Code:
    Dim strValues
    Dim arrValues
    Do While Not myRS.eof
      strValues = strValues & request.form("textbox" & myRs("ID")) &","
      myRS.MoveNext
    Loop
    strValues = left(strValues, len(strValues)-1)
    arrValues = split(strValues,",")
    so you are probably not too far wrong in what you are trying.... if you want to attach your code I'm happy to have a look over it for you.

  5. #5
    Join Date
    May 2004
    Posts
    21
    thanks
    I will test it and if this is what I really want it's great
    otherwise I will attach that page and take a look at the code
    thanks again...
    Last edited by kasic; 10-06-04 at 14:03.

  6. #6
    Join Date
    Dec 2003
    Posts
    454
    Post your part of code related to the form to be sent.

  7. #7
    Join Date
    May 2004
    Posts
    21
    here I submited the whole page, becouse I dodn't know in wich part of page it's error... I'll hope you'll fix it... thanx

    P.S. I've changed extension to .txt, becouse of attachment that not supports .asp ext. and I only have WinRAR installed on this mashine, so I thought this is much easier....
    Attached Files Attached Files

  8. #8
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    with the page you have posted you are trying to mix and match request.querystring with request.form and it doesn't really work because you are getting a querystring from the hyperlink which is not submitting the form (so there are no form values).

  9. #9
    Join Date
    May 2004
    Posts
    21
    @ rokslide

    can you tell me what to do to fix it?
    Iam stuck with than and I can't go further...

  10. #10
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you have a couple of choices.... what I would do is create change the hyperlink to a javascript function call that populates a hidden field with the value you currently have in the hyperlink query string and submits the form.

    that way all details will be available by request.form

Posting Permissions

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