Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My multiple value selection has comma-space in it

Status
Not open for further replies.

TigerWood

Programmer
Apr 25, 2003
7
US
Probelm:
I select the following values from a list box (name = ListValue):

Smith, John
Hudson, Alice

strSelectValue = Request.Form("ListValue")

The strSelectValue returns:
"Smith, John, Hudson, Alice"

I get 4 values instead of two. How can I handle this problem?

Thank you for your help.
 
Don't use commas in your values on the client side. Pick something like a "/" instead. Use Replace( ) to change the "," to... say "\", then use Replace to change the "/" to ",", finally Split( ) on "\".
Code:
<SELECT NAME=&quot;ListValue&quot; MULTIPLE>
<OPTION VALUE=&quot;Smith/ John&quot;>Smith, John
<OPTION VALUE=&quot;Hudson/ Alice&quot;>Hudson, Alice
<OPTION VALUE=&quot;Fancypants/ Mercedes&quot;>Fancypants, Mercedes
</SELECT>
Messy, but that's life.

Anyone got a better idea?
 
Thank you very much for your guideline. This is good enough - unless others have better idea.
 
Dim intLoop
For intLoop = 1 To Request.Form(&quot;ListValue&quot;).Count
Response.Write Request.Form(&quot;ListValue&quot;)(intLoop)
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top