#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    8
    Rep Power
    0

    Need to turn string into variable


    Hey all,
    I have a bunch of checkboxes with different values in a form, when the form is submitted I am using the following to collect all the values:

    Code:
    chkCnt=request.form("pocertstring").count
    
    i=1
    if chkCnt > 0 then
      do while i <=chkCnt
        response.write request.form("pocertstring")(i) & ".pdf,"
      i=i+1
      loop
    end if
    I response write all the values and can see the results: 107541.pdf,111281.pdf,111398.pdf,
    Great, but I need this in a variable so I can do something with it... by changing response.write to xxx=, I can only access the first value in the string.

    Any help appreciated!
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,544
    Rep Power
    4542
    Instead of just writing out the pdf filenames, you could build the list of filenames into an array or collection, then iterate through that array to do what you need with each name.

    Comments on this post

    • Will-O-The-Wisp agrees : Thank you!
    ======
    Doug G
    ======
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    8
    Rep Power
    0
    Originally Posted by Doug G
    Instead of just writing out the pdf filenames, you could build the list of filenames into an array or collection, then iterate through that array to do what you need with each name.
    Yes this may be a better option but I am unsure how to do this...
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    8
    Rep Power
    0
    Originally Posted by rtown
    Yes this may be a better option but I am unsure how to do this...


    Cancel this! This was way easier than I though. There is no need to count how many checkboxes were checked and then cycle through this amount. A simple cleanstring=Request.Form("pocertstring") is enough!

    I then removed whitespace with a split function... done!
  8. #5
  9. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,544
    Rep Power
    4542
    glad to hear you got a solution
    ======
    Doug G
    ======
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton

IMN logo majestic logo threadwatch logo seochat tools logo