Hello,

This is an issue that I've come across with the new rails 1.2.5
release, but I'm not sure if the problem lies within Rails, prototype
or scriptaculous.  My testing seems to point more towards
scriptaculous, but I'm not sure and maybe somebody can explain this
one.

Looking at the two method calls using an array parameter (field), the
url is the exact same for both below (the urls below are how rails
generates these now with recent patches)...

new Ajax.Autocompleter('test', 'test_auto_complete',
'/test/auto_complete_for_test?field%5B%5D=a&field%5B%5D=b&field%5B%5D=c',
{})

new 
Ajax.Request('/test/auto_complete_for_test?field%5B%5D=a&field%5B%5D=b&field%5B%5D=c');

You can see there is no difference in the url format above.

Now when the Request method is called, rails receives the parameters
as follows (which is correct)...

Processing TestController#auto_complete_for_test (for 127.0.0.1 at
2007-10-14 18:18:34) [POST]
  Parameters: {"action"=>"auto_complete_for_test", "field"=>["a", "b",
"c"], "controller"=>"test"}

And when the Autocompleter method is called, rails receives the
parameters as follows (which is wrong, see that the field param is
broken)...

Processing TestController#auto_complete_for_test (for 127.0.0.1 at
2007-10-14 18:21:22) [POST]
  Parameters: {"action"=>"auto_complete_for_test", "field"=>["a"],
"controller"=>"test", "amp;field"=>["b", "c"], "test"=>"test"}

To test, I put a js alert in Ajax.Request to display the url (which
the Autocompleter calls as well) and when using Ajax.Request the url
looks like this (& removed)...

'/test/auto_complete_for_test?field%5B%5D=a&field%5B%5D=b&field%5B%5D=c'

but when called via Autocompleter, it looks like this (& not removed)...

'/test/auto_complete_for_test?field%5B%5D=a&field%5B%5D=b&field%5B%5D=c'

Looking at Autocompleter code, I see no url translation or escaping,
just a simple assignment for use with Ajax.Rqeuest, so what's going on
here?  I can see why rails would receive the wrong data between the
two, but why does the same url produce different results.  I'm totally
confused on this one.  Again, this looks like a javascript issue from
either prototype or scriptaculous, but this issue didn't seem to
appear until the latest Rails was released.

Thanks,
Andrew

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to