Problem with form_remote_tag and hidden fields

I’m using form_remote_tag to generate a remote form that contains
nothing but a hidden_field_tag and a submit_tag. The form appears to
be generated correctly (I see the tag and the field
with type=“hidden” contained in it) and it’s submitted using Ajax to
the correct URL, but the hidden field is not sent to the server. Is
there any reason this shouldn’t work?

Quoting bigbanger [email protected]:

I’m using form_remote_tag to generate a remote form that contains
nothing but a hidden_field_tag and a submit_tag. The form appears to
be generated correctly (I see the tag and the field
with type=“hidden” contained in it) and it’s submitted using Ajax to
the correct URL, but the hidden field is not sent to the server. Is
there any reason this shouldn’t work?

I am using this in Rails 1.2 and Rails 2.0 and it works fine. Here is
the
relevant code from my template:

<% form_remote_tag(:url=>{:controller=>'comments', :action=>'add'},
    :update=>"comments_#{show.id}", :position=>:bottom) do %>
  <%= hidden_field_tag('comment[task_id]', 0) %>
  <%= hidden_field_tag('comment[parent_id]', show.id) %>

  <%= submit_tag :reply.l %>
<% end %>

HTH,
Jeffrey

Hmm, my code looks pretty much the same as yours (although I’m using
RESTful routes). As I said, the HTML appears to be generated
correctly, but for some reason the hidden field isn’t being serialized
to the server in the Ajax request. I added a request parameter
instead and that worked in the interim, but I’m not sure why the
hidden field didn’t work…

On Dec 21, 6:59 pm, Jeffrey T. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs