# Double encoding of form action with form\_remote\_tag .. What

**URL:** <https://www.ruby-forum.com/t/double-encoding-of-form-action-with-form-remote-tag-what/112565>\
**Category:** Rails\
**Created:** [August 20, 2007, 11:41pm UTC](https://www.ruby-forum.com/t/double-encoding-of-form-action-with-form-remote-tag-what/112565 "2007-08-20T23:41:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [August 20, 2007, 11:41pm UTC](https://www.ruby-forum.com/t/double-encoding-of-form-action-with-form-remote-tag-what/112565/1 "2007-08-20T23:41:36Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [August 22, 2007, 12:02am UTC](https://www.ruby-forum.com/t/double-encoding-of-form-action-with-form-remote-tag-what/112565/2 "2007-08-22T00:02:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 22, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/double-encoding-of-form-action-with-form-remote-tag-what/112565/3 "2007-10-22T18:08:43Z")

</div>

I have the same problem.

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

Cheers,  
Tomasz Bak
