Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#775 closed defect (invalid)

encodeForm doesn't handle multiple checkboxes / multi-select

Reported by: mde@… Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

encodeForm adds a new variable of the same name on the query string for each checked checkbox in a group that have the same 'name' property, giving you weird-looking results like 'foo=asdf&boo=12&boo=37&boo=42.' :) And of course, trying to retrieve the value the standard way with a scripting language like Perl or Ruby on the server side (e.g., cgiboo?) only pulls out the first value.

Multiple-selects have the same problem.

I have made a small patch to serialize the values for checked/selected items in multi-selects or groups of same-name checkboxes into a comma-separated list -- you'll get 'foo=asdf&boo=12,37,42' so you can associate all the values with the single variable name.

Attachments (1)

dojo.io.encodeForm.20060521.patch (1.4 KB) - added by mde@… 14 years ago.
Patch for encodeForm multi-checkbox issue

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by mde@…

Patch for encodeForm multi-checkbox issue

comment:1 Changed 14 years ago by alex

IIRC the current behavior is in place to mimic other user agents.

comment:2 Changed 14 years ago by mde@…

Resolution: invalid
Status: newclosed

Yep, a quick look at some raw POST data verifies that I was totally talking through my hat. The current encodeForm has got it right. I should have done my homework better.

comment:3 Changed 14 years ago by alex

Milestone: 0.3.1

comment:4 Changed 12 years ago by (none)

Milestone: 0.3.1

Milestone 0.3.1 deleted

Note: See TracTickets for help on using tickets.