I'd prefer a non-incompatible fix for this. One obvious improvement would be to add a dict() function:
http://github.com/cederberg/mochikit-patches/blob/1e0dd2fcc3c80e1fe78f87d9ca7d9ba16b9eee09/MochiKit/Base.js#L71 But for forms, some values might be repeated so that wouldn't solve it all. Actually, I don't know if the current formContents() handles that correctly... For the proposed widget library I rewrote it as this: http://github.com/cederberg/mochikit-patches/blob/1e0dd2fcc3c80e1fe78f87d9ca7d9ba16b9eee09/MochiKit/Widget.js#L963 None of the above is in the MochiKit repository yet due to lack of time on my part. Been working full-time with other stuff for a while, but I'm planning to come back to MochiKit eventually. And tend to the issues reported in Trac and here on the list. Anyway. I think the best solution might be to create a new formContents (different name) to allow for an alternative API. We'd then deprecate the old implementation and remove entirely eventually. Improving the download packager, we might even provide a "strict" version or so. Cheers, /Per On Fri, Apr 17, 2009 at 9:13 PM, Eoghan Murray <eoghanomur...@gmail.com> wrote: > Here is a patch that converts the output of DOM.formContents to a dictionary. > > This has been raised as a difficulty before [1] and has bitten me a > few times when trying to edit the return value of formContents before > converting it to a query string. > > In this patch, the previous format of: > [['name1', 'name2', 'name2'], ['value1', 'value2', 'value3']] > becomes: > {'name1': ['value1'], 'name2': ['value2', 'value3'] } > i.e. values are always stored in lists even if there is only one value. > > This is backwards incompatible, but I've also updated Base.queryString > so that it still works with the new format. > > If it is accepted I can update docs & version history. > > Eoghan > > [1] > http://groups.google.com/group/mochikit/browse_thread/thread/5d970041f1696b10/a5fa33325d639cf4 > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to mochikit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---