I've written new code that I think will offer the most functionality
to the most people. The only functions modified are
Form.serializeElements, Form.Methods.serialize, Hash.toQueryString and
String.prototype.toQueryParams.
- Forms are serialized directly to strings so that there is no hash
middle-step to introduce inconsistencies favoring any server-side
technology
- When creating a hash from a string, an optional parameter
"strict" (use true) will produce:
foo=bar&foo=baz {foo:['baz']} rather than {foo:['bar','baz']} (the
default)
foo[]=bar&foo[]=baz is still {foo:['bar','baz']} in both cases
foo[0]=bar&foo[1]=baz is also supported to enable nesting
- Hash.toQueryString will add indexes to arrays which allows for
complete nesting of arrays and hashes. This shouldn't be a problem for
anyone when serializing forms because this is not used during form
serialization.
- String.prototype.toQueryParams can correctly deserialize any string
produced by toQueryString, even those with nested hashes and arrays
(only possible with explicit array indexes).
http://colin.mollenhour.com/toquery.php
http://pastie.caboo.se/48450
Does anyone have any problems with this proposal?
Thanks,
Colin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---