luke
2007-Aug-20 21:41 UTC
Double encoding of form action with form_remote_tag .. What am I doing wrong?
Hi, I''m using a form_remote_tag(), except the parameters in the action attribute are receiving double HTML encoding. Here''s a version of what I''ve written: <% form_remote_tag :update => "change", :url => { :action => ''change'', :param1 => 1, :param2 => 2 } do |f| -%> <% end %> The rendered action attribute becomes: action="/ldun024/users/ldun024/password.html/change? param1=1&amp;param2=2" I''ve read over the documentation, here... http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000529 But it says form_remote_tag is like link_to_remote in the way you specify the URL, and I''m not sure what the difference is between my code and the example.. Thanks for any help, Luke --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
luke
2007-Aug-20 23:00 UTC
Re: Double encoding of form action with form_remote_tag .. What am I doing wrong?
Okay, I''ve got a fix, but still I wonder if I was doing something wrong, or is this a bug in the form_remote_tag() helper? I wanted to have an action attribute in the form tag, so that I could reuse the ajax form in a non-javascript view and still have it work. Following the example in the API docs as far as I could tell my action URL was being double HTML encoded. Adding a specific :html hash of options in the form_remote_tag, and within that specifying an :action attribute, using url_for to construct the URL, and passing url_for the :escape => false option has done the trick. <% form_remote_tag :update => "change", :url => { :action => ''change'', :param1 => 1, :param2 => 2 }, :html => { :action => url_for(:escape => false, :action => ''change'', :param1 => 1, :param2 => 2) } do |f| -%> <% end %> Still curious about whether this is the only way to achieve it? Seems incorrect to me. Luke On Aug 21, 9:41 am, luke <ldunca...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m using a form_remote_tag(), except the parameters in the action > attribute are receiving double HTML encoding. > > Here''s a version of what I''ve written: > > <% form_remote_tag :update => "change", :url => { :action => > ''change'', :param1 => 1, :param2 => 2 } do |f| -%> > <% end %> > > The rendered action attribute becomes: > > action="/ldun024/users/ldun024/password.html/change? > param1=1&amp;param2=2" > > I''ve read over the documentation, here... > > http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper... > > But it says form_remote_tag is like link_to_remote in the way you > specify the URL, and I''m not sure what the difference is between my > code and the example.. > > Thanks for any help, > > Luke--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Bak
2007-Oct-22 16:08 UTC
Re: Double encoding of form action with form_remote_tag .. W
I have the same problem. It seems the http://dev.rubyonrails.org/ticket/6526 change was reverted? Cheers, Tomasz Bak -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---