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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with commas in arrays

Status
Not open for further replies.

ncar35b

Technical User
Jan 10, 2003
55
US
Hi. I have an HTML form with 5 text fields. All have the same input name (<input type="text" name="testfield">). I couldn't name them differently for this application.

It is easy to break this up into an array on the following ASP page, but if a user puts a comma in one of the text fields, that individual field is broken up into two or more fields. Is there a way I can change the default delimiter ", " to something else like "****" maybe? Any help would be greatly appreciated!!
 
Arr = Split("Your text here","****")

The second argument is the delimiter.
 
Thanks, but that doesn't quite solve it. Pretend these are the five fields entered on the HTML page:

1) test1
2) test2, test3, test4
3) test5
4) test6, test 7
5) test8

using your code, they would be split:

test1
test2
test3
test4
test5
test6
test7
test8

The ASP can't tell the difference between a comma entered by the user and one entered in the post/get method.

I need the commas entered by the user to be ignored.
 
it would be an ugly hack but you could add some client side script triggered by the HTML form's onSubmit that would either remove the commas or replace them with some unlikely character or set of characters that you could undo on the other side...

but if you could do that then I suppose you could also just change the names of your HTML input elements so this problem would go away
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top