Double encoding of form action with form_remote_tag .. What

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

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

I have the same problem.

It seems the http://dev.rubyonrails.org/ticket/6526 change was reverted?

Cheers,
Tomasz Bak