How do I loop through a comma-separated list?

D

Dave Anderson

Bob Barrows said:
A JScript function, Split(), followed by

Unless [Split] is a method of the Request.Form object, even JScript won't
like this, though JScript will certainly be happy with

myArray = Request.Form("ListBox").Item.split(",")

....since R.F().Item is a string value.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
R

Rob Greene

It seems to me that it works like this: request.form("x") returns a
string. The string has the split method.

-rwg
This is what I think, not necessarily what is right
 
R

Ray at

In jscript, strings are objects and have methods. In VBscript, they do not.
The code she posted had a mixture of vbscript and jscript and some third
language I've never seen.

Ray at work
 
D

Dave Anderson

Rob Greene said:
It seems to me that it works like this: request.form("x")
returns a string. The string has the split method.

Request.Form("x") is not a string value, nor a String Object. It is an
object with properties .Key, .Count and .Item. It has no native .Split()
method.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 02 feb 2004 in
microsoft.public.inetserver.asp.general:
Request.Form("x") is not a string value, nor a String Object. It is an
object with properties .Key, .Count and .Item. It has no native .Split()
method.

So:

arr = request.form("x").item.split(",")

?
 
C

Chris Hohmann

Dave Anderson said:
Request.Form("x") is not a string value, nor a String Object. It is an
object with properties .Key, .Count and .Item. It has no native ..Split()
method.

I don't believe that Request.Form("x") supports the Key property. The
Request object is immutable.

-Chris Hohmann
 
D

Dave Anderson

Evertjan. said:
arr = request.form("x").item.split(",")

?

JScript is case sensitive. That should be

Request.Form("x").Item.split(",")

And if you're unsure if there will even be a name-value pair for "x", you
can use this:

(Request.Form("x").Item || "").split(",")

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top