views:

379

answers:

3

I have a classic ASP page that submits back to itself. Strangely, the values being returned from the selects have commas being added to the ends of them. Has anyone run into anything like this before? Any troubleshooting steps or tools recommended?

I'm expecting the values to be returned just as numbers - they are the IDs of the values displayed in the option.

I've checked for mystery commas in the page and can't locate any - nor in the data that I'm pulling through.

(note - these are single-selects, not multiple)

+5  A: 

Sounds like you have duplicate form fields. Your values are concatenated together with commas, like this:

<input type="text" name="name1" value="value1">
<input type="text" name="name1" value="value2">
<input type="text" name="name2" value="value3">

Becomes

name1=value1,value2
name2=value3

If the second name1 has no value, it becomes

name1=value1,
name2=value3
Sune Rievers
+1  A: 

Are there two form elements with the same name? If you have Firebug installed, it's worth taking a look to see if the data is actually being posted with the commas or if it's happening after ASP gets its awful paws on it.

Tom
At least it *has* paws. Not awful ragged claws like the monstrosity that is ASP.NET WebForms...
Dylan Beattie
So you see WebForms as the J. Alfred Prufrock of programming?
Tom
Apparently so, although I didn't know that I did until I Googled J. Alfred Prufrock... ;)
Dylan Beattie
+2  A: 

Do you have multiple form elements on your page with the same name?

In classic ASP, multiple form values with the same name are joined into a comma-separated string in the Request.Form / Request.QueryString collections - so if there's a hidden field or textbox with name="foo" as well as your <select name="foo">, you'll get the second (empty) value joined to the first, separated by a comma.

Dylan Beattie