Opened 14 years ago
Closed 14 years ago
#4259 closed defect (fixed)
[CLA] multiple input values with the same name get clobbered by dojo.formToObject
Reported by: | guest | Owned by: | James Burke |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | IO | Version: | 0.9 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
Consider:
<form name='abc'> <input name='q' value='a'> <input name='q' value='b'> <input name='q' value='c'> </form>
The browser will send:
q=a&q=b&q=c
formToObject produces:
q=a
because the ret[] array (internal to formToObject) does not take into account the multiple values unless your form has a multiple=true attribute on the select.
DISCUSSION:
I think you want to do what the browser would do in the formToObject code. If I hit submit or I use xhrPost, I would want the back-end code to do the same thing without special-casing.
RELAVANCE:
It turns out that PHP has a notion for array posting that takes multiple values of an input and crushes them into an array if they are formatted as a[]. So to get a list of names for a party you could do something like:
<input type='text' name='name[]'>
and then copy that input tag and duplicate it verbatim (via, say, DHTML) to get an array with several names.
The patch is below and my CLA is on file with dojo.
Attachments (2)
Change History (8)
Changed 14 years ago by
Attachment: | formtoobject.diff.txt added |
---|
comment:1 Changed 14 years ago by
Milestone: | 0.9 → 1.0 |
---|
comment:3 Changed 14 years ago by
Cc: | http://trac.dojotoolkit.org/ticket/4259 added |
---|
Adding a CC for someone else thats watching for this bug fix.
comment:4 Changed 14 years ago by
Cc: | [email protected]… added; http://trac.dojotoolkit.org/ticket/4259 removed |
---|
fixing CC... my bad.
comment:5 Changed 14 years ago by
Summary: | multiple input values with the same name get clobbered by dojo.formToObject → [CLA] multiple input values with the same name get clobbered by dojo.formToObject |
---|
verified CLA, just need the patch reviewed and imported.
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
diff (cla on file)