![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
I have a form like this, which looks like a grid of entries. |
|
now if I submit that form the resulting URL looks like /dosomething?foo=1&bar=3&foo=2&bar=4 |
|
so, my question is: are the values guaranteed to be correlated? |
|
(or perhaps a better questions is, "What are the rules (if any) for multiple fields with the same name, and do they vary by browser?) |
#3
| |||
| |||
|
|
Scripsit Chris Curvey: I have a form like this, which looks like a grid of entries. Why? It looks contrived, and it has poor accessibility, since input fields have no labels and there is no easy way (and maybe no feasible way) add them. now if I submit that form the resulting URL looks like /dosomething?foo=1&bar=3&foo=2&bar=4 OK. so, my question is: are the values guaranteed to be correlated? By the specifications, yes. In practice, there should be no reason to count on it. Good form data processing starts from parsing the data into variables, normally losing the order anyway. (or perhaps a better questions is, "What are the rules (if any) for multiple fields with the same name, and do they vary by browser?) For multiple fields with the same name, data from all of them is included if they are "successful" at the time of submission. See http://www.w3.org/TR/REC-html40/inte...html#h-17.13.2 The successful of a text field is subject to interpretation if no data has been typed into it, but browsers seem to treat them as successful with empty values, including data like foo= into the form data set. Anyway, the important thing is that if two fields with the same name have been filled out, both are "successful", hence included, but don't count on any particular order. A very cautious man might avoid using the same name, at least if there is an easy alternative. |
#4
| |||
| |||
|
|
What I get on the server is an array containing the values,eg: foo = a, b, c, d |
![]() |
| Thread Tools | |
| Display Modes | |
| |