October 1st, 2015, 12:26 PM
-
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!
October 1st, 2015, 12:38 PM
-
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
======
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
October 1st, 2015, 03:50 PM
-
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...
October 1st, 2015, 05:25 PM
-
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!
October 2nd, 2015, 06:57 PM
-
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