Mark Reginald James
2006-Nov-20 06:56 UTC
Issue with posts of arrays of params in Prototype 1.5RC2
Hello again, I''ve got another issue with the way Prototype SVN (1.5RC2) posts parameters in AJAX calls, and this time it''s more likely to be a bug rather than a quirk-change because the behaviour is different to an ordinary browser post. But given the outcome of my earlier problem, I want to check before adding a ticket. When an array of parameters is posted from multiple fields with names like ''name[]'', the Firefox browser always posts the whole array for an ordinary HTTP POST, while a Prototype AJAX post leaves out the fields that have empty-string values, which gives problems when the position of a value in the sequence is important. The code that implements this behaviour is in the toQueryParams function: var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; ... if (value) hash[name].push(value); Is there a good reason this shouldn''t be changed to something like: var value = decodeURIComponent(pair[1]); ... hash[name].push(value); ? These changes seem to fix the problem. Thanks. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
neil-QXDHrXUuHbUBbbOlS08Dvr0Ud+EcFu5g@public.gmane.org
2006-Nov-20 11:05 UTC
Re: Issue with posts of arrays of params in Prototype 1.5RC2
I noticed this problem a couple of weeks ago and took to using the option member postBody to pass raw post data straight through to the XHR calls in Prototype. I think this is best until a fix is committed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---