# EncodeURIComponent in form\_remote\_tag

**URL:** <https://www.ruby-forum.com/t/encodeuricomponent-in-form-remote-tag/138321>\
**Category:** Rails\
**Created:** [May 22, 2008, 12:45am UTC](https://www.ruby-forum.com/t/encodeuricomponent-in-form-remote-tag/138321 "2008-05-22T00:45:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [May 22, 2008, 12:45am UTC](https://www.ruby-forum.com/t/encodeuricomponent-in-form-remote-tag/138321/1 "2008-05-22T00:45:40Z")

</div>

Hi All,

for one particular reason ( particular div layouts to enable opaque  
text on on transparent div), my end form tag is appearing before my  
single text box, as shown below :

 \<% form\_remote\_tag(:update=\>'yourpoints', :url =\> { :controller=\>'promotioncodes', :action=\>'redeem\_code'},:method=\>'post' ) do %\> \<%= link\_to\_remote image\_tag('../images/redeem\_code\_bttn.png'), { :url =\> {:controller=\>'promotioncodes',:action =\> 'checkvalidity' }, :with =\> 'code='+encodeURIComponent(code) } %\> 

 \<%= text\_field\_tag :code, params[:code],:size=\>'25px',:style=\>'margin-top:5px;height:25px;border- width:1px;border-color:white;font-size:13px;' %\>

\<% end %\>

Source code from mozilla shows clearly that the end form tag appears  
before my text box.  
And also, I’m forced to use this layout to avoid my textbox from being  
transparent.

That’s why I’m using encoreURIComponent in my link\_to\_remote tag.

But not functionning right now…

Does anyone know how I can solve this.

Regards,

Joel

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [May 22, 2008, 10:38am UTC](https://www.ruby-forum.com/t/encodeuricomponent-in-form-remote-tag/138321/2 "2008-05-22T10:38:47Z")

</div>

On May 21, 11:45 pm, joel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> for one particular reason ( particular div layouts to enable opaque  
> text on on transparent div), my end form tag is appearing before my  
> single text box, as shown below :

Your html is screwed: you’re closing tags in the wrong order (eg  
inside your form you’re closing a div which you opened outside your  
form) and so the browser is just guessing at what you meant. Also  
your :with parameter looks mesed up to me (I’m surprised that it even  
runs, given that encodeURIComponent is a javascript function and that  
you don’t appear to have a code variable defined (in ruby or in  
javascript). I wrote up some stuff on :with at

> **[:with or :without you: link\_to\_remote's mysterious parameter - Space Vatican](https://www.spacevatican.org/2008/5/17/with-or-without-you-link_to_remote-s-mysterious-parameter/)**
>
> One of the nice things about Rails is that it makes it really easy to get off the ground with Ajax, thanks to the link\_to\_remote helper (and all the …

a few days ago.

Fred
