EncodeURIComponent in form_remote_tag

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 :

<div id='redeem-box' style='padding:8px;float:left;'>
    <% 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)
      } %>
    <div id='testa' style='width:40%;height:25px;position:relative;top:
      <%= text_field_tag :code,
width:1px;border-color:white;font-size:13px;' %><p><br></br>
<% 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

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.



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
a few days ago.