fields_for and form_remote_for not work properly

I think I'm not the first to ask this question.

I have a fields_for within a form_remote_for and this not work
properly , the remote_form_for serialize strangely all params passed
by fields_for.

with a form_for it's work perfectly.

Rails -v = 2.3.8

any help ?

I think I'm not the first to ask this question.

I have a fields_for within a form_remote_for and this not work
properly , the remote_form_for serialize strangely all params passed
by fields_for.

What do the params look like ? What does your form look like ?

Fred

/////////// Partial
<%= error_messages_for :company %>
    <% form_remote_for :company , :url =>{:action
=> :update_notif} , :html=>{} do |f| -%>
  <div id="notifications">
    <%= add_notification_link("Add notification") %>
    <table class="list">
      <tr id="tr_id_1"><th>Email</th><th colspan="2">Label</th></tr>
      <%= render :partial => "companies/notification" , :collection =>
@company.notifications%>
    </table>
  </div>
<%= f.submit "Save"%>

    <%end%>

////////// _notification.html.erb

<% new_or_existing = notification.new_record? ? 'new' : 'existing' %>
<% prefix = "company[#{new_or_existing}_notification_attributes][]" %>
<% fields_for prefix, notification do |notification_form| -%>

  <tr>
    <td>
      <% id = new_or_existing == "new" ?
"company_new_notification_attributes_email" : nil %>
      <%= notification_form.text_field_with_auto_complete :email,
{:id=> id} ,
        {:url =>
{:controller=>:autocompletes , :action=>"for_company_notifications_email"},
        :method => :get,
        :frequency=>0.2,
        :skip_style => true,
        :select =>"email",
        :with => "'text_field_val=' + element.value"
      }
    %>
    </td>
    <td>
      <%= notification_form.text_field(:label) %>
    </td>
    <td>
      <% if new_or_existing == "new" %>
        <%= link_to_function "<img src='/images/delete.png'>", "$
(this).up('tr').remove()" %>
      <% else %>
        <%= link_to_delete :notifications,:destroy,notification.id %>

      <%end%>
    </td>
  </tr>
<% end -%>

any help?

with form_for :

Parameters: {"company"=>{"new_notification_attributes"=>[{"label"=>"",
"email"=>""}, {"label"=>"", "email"=>""}],
"existing_notification_attributes"=>{"3"=>{"label"=>"test",
"email"=>"test@test.com"}}}

with form_remote_for :

Parameters: {"company"=>{"new_notification_attributes"=>[{"label"=>""},
{ "email"=>""}, {"label"=>""}, {"email"=>""}],
"existing_notification_attributes"=>{"3"=>{"label"=>"test",
"email"=>"test@test.com"}}}

???

with form_for :

Parameters: {"company"=>{"new_notification_attributes"=>[{"label"=>"",
"email"=>""}, {"label"=>"", "email"=>""}],
"existing_notification_attributes"=>{"3"=>{"label"=>"test",
"email"=>"t...@test.com"}}}

Have you had a look at the actual body of the post (ie before rails
tries to parse it)? at a guess it looks like prototype may be
serializing the form in an unexpected way. Can you reduce this to a
minimal test case ?

Fred