Forum: Ruby on Rails remote_form_for issue

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
28c315da59bc0bc0a544ed4a75ad26e9?d=identicon&s=25 Pierre-Alexandre Meyer (Guest)
on 2007-06-04 01:43
(Received via mailing list)
Hi everybody,

I'm trying to change my current forms in my app to remote_forms. It was
my understanding that remote_form_for and form_for work in the same way,
so I just wanted to change the methods. My code looks like:

<% form_remote_for :post, :url => posts_url do |f| %>
  <%= render :partial => 'form_posts', :locals => {:f => f} %>
  <%= table_submit_tag "Chercher" %>
<% end %>

The problem of this code is that it generates an empty form:

<form id="foo" onsubmit="new
Ajax.Request('http://localhost:3000/posts/',
{asynchronous:true, evalScripts:true, parameters:Form.serialize(this)});
return false;" method="post" action="http://localhost:3000/posts/"/>

params[:post] is empty (Form.serialize(this) serializes an emtpy
form...). Anyone has an idea what I am missing? I thought it was because
the partial wasn't passed to the block, but I have the same proble
when I past it. Moreover @post does exist and I have the same problem
without using block, but using form_remote_tag.

The partial is dummy: f.text_field :body

Thanks,

--
,========================.
| Pierre-Alexandre Meyer |
| email : pam@mouraf.org |
`========================'
72eb65fa089082d3bd8b38a5596ad331?d=identicon&s=25 Keynan Pratt (keynan)
on 2007-06-04 07:30
what version of rails?
There where some problems with this that helper method in 1.1.6.
However, it should work as is in 1.2.x
28c315da59bc0bc0a544ed4a75ad26e9?d=identicon&s=25 Pierre-Alexandre Meyer (Guest)
on 2007-06-04 09:06
(Received via mailing list)
On Mon, Jun 04, 2007 at 07:30:11AM +0200, Keynan Pratt wrote :
> what version of rails?
> There where some problems with this that helper method in 1.1.6.
> However, it should work as is in 1.2.x

Rails 1.2.3

That's really weird...

--
,========================.
| Pierre-Alexandre Meyer |
| email : pam@mouraf.org |
`========================'
28c315da59bc0bc0a544ed4a75ad26e9?d=identicon&s=25 Pierre-Alexandre Meyer (Guest)
on 2007-06-04 19:58
(Received via mailing list)
On Mon, Jun 04, 2007 at 09:05:43AM +0200, Pierre-Alexandre Meyer wrote :
> That's really weird...

Extracted from http://www.cs.tut.fi/~jkorpela/forms/tables.html#example:
  Tables and forms can be nested either way. But if you put forms into
  tables, each form must be completely included into a single table cell
  (one TD element in practice). Thereby the forms are each completely
  independent. See my document on choices in HTML forms for some simple
  examples.

It was an HTML problem. Sorry.

--
,========================.
| Pierre-Alexandre Meyer |
| email : pam@mouraf.org |
`========================'
This topic is locked and can not be replied to.