Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1498 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Multiple input fields with the same name do not yield multiple values in ajax.js RemoteRequest

Reported by: jype Owned by: chrisz
Priority: normal Milestone: 1.1
Component: TurboGears Version: 1.0.3
Severity: normal Keywords: multipleselectfield,checkboxlist,ajax,discarded values
Cc:

Description

When using MultipleSelectField? or CheckBoxList? in a RemoteForm, ajax.js invalidly transforms form contents from two lists into a dictionary. Thus, if multiple fields have the same name, only the last value is stored in the dictionary, others are clobbered in turn.

The solution is not to create a dictionary - MochiKits? queryString function already properly handles a list of two lists.

I have created a patch for ajax.js that fixes the problem for me for MochiKit? 1.3.1 and 1.4(svn) simultaneously.

Attachments

ajax.js.diff Download (1.2 KB) - added by jype 12 years ago.
Patch against 1.0.4b2 ajax.js

Change History

Changed 12 years ago by jype

Patch against 1.0.4b2 ajax.js

comment:1 Changed 12 years ago by jype

I also checked the trunk version - it doesn't use MochiKit? anymore, but still fails to address this problem. While lack of time doesn't permit me to fix the trunk right now, it should be fairly straightforward, just check for checkboxes and select multiples and handle them appropriately.

Before the ticket is fixed I'd really like some peer review - while it works for me, I haven't tested it extensively.

comment:2 Changed 11 years ago by Chris Arndt

  • Owner changed from anonymous to Chris Arndt
  • Milestone set to 1.1

comment:3 Changed 11 years ago by droggisch

  • Owner changed from Chris Arndt to chriz

I fixed this in r5290. However, as ajax.js relies on MochiKit?, and formContents below MK1.4 has a bug that also exposes that behavior, one needs to use MK1.4. Which shouldn't be to much of a problem, however it should be mentioned.

comment:5 Changed 11 years ago by Chris Arndt

  • Owner changed from chriz to chrisz

comment:6 Changed 11 years ago by Chris Arndt

We should set tg_mochikit_version = "1.4" in app.cfg in the quickstart templates then.

comment:7 Changed 11 years ago by Chris Arndt

  • Status changed from new to closed
  • Resolution set to fixed

Apps quickstarted with TG >= 1.1 now specify MochiKit 1.4 by default (r5329 & r5330).

comment:8 Changed 11 years ago by chrisz

TG >= 1.0.8 also supports MochiKit? 1.4 now (though not by default).

Note: See TracTickets for help on using tickets.