Double encoding of form action with form_remote_tag .. What


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:


I’ve read over the documentation, here…

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,


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.


I have the same problem.

It seems the change was reverted?

Tomasz Bak