Hi,
being relativly new to RoR, I''m having a problem which I found
described
in this forum and somewhere else - but with no solution. I know, that it
may be bad to mix table and form tags, but the first solution of an in
place editing within a table looked nice:
Version using form_for:
<tr>
<%form_for :time_record, :url => { :action =>
"add_time_record" } do
|f| %>
<% f.date_select(:day, :disabled => true, :order => [:day, :month])
%>
<td><%= f.date_select(:day, :order => [:day, :month])
%></td>
<td><%= f.collection_select(:user_id, @users, :id, :login_name)
%></td>
<td><%= f.collection_select(:project_id, @projects, :id, :name)
%></td>
<td><%= f.text_field :quantity, :size => 4 %></td>
<td><%= f.text_field :description, :size => 50 %></td>
<td><%= submit_tag "Zeit Erfassen", :class =>
"submit" %></td>
<% end %>
</tr>
Works fine.
Iterating in small steps to AJAX, the next iteration was:
<tr>
<%form_remote_for :time_record, :url => { :action =>
"add_time_record"
} do |f| %>
<% f.date_select(:day, :disabled => true, :order => [:day, :month])
%>
<td><%= f.date_select(:day, :order => [:day, :month])
%></td>
<td><%= f.collection_select(:user_id, @users, :id, :login_name)
%></td>
<td><%= f.collection_select(:project_id, @projects, :id, :name)
%></td>
<td><%= f.text_field :quantity, :size => 4 %></td>
<td><%= f.text_field :description, :size => 50 %></td>
<td><%= submit_tag "Zeit Erfassen" %></td>
<% end %>
</tr>
Which did not work. Changing the whole thing to
<tr class="list-line-even">
<td>
<%form_remote_for :time_record, :url => { :action =>
"add_time_record" } do |f| %>
<%= f.date_select(:day, :order => [:day, :month]) %>
<%= f.collection_select(:user_id, @users, :id, :login_name) %>
<%= f.collection_select(:project_id, @projects, :id, :name) %>
<%= f.text_field :quantity, :size => 4 %>
<%= f.text_field :description, :size => 50 %>
<%= submit_tag "Zeit Erfassen" %>
<% end %>
</td>
</tr>
works fine again...
Which means mixing of table and form tags destroys the parameter
information.
In my opinion, form_for and form_remote_for should behave the same way.
Hopefully someone has a solution to this problem ?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Andor Greißl wrote:> Iterating in small steps to AJAX, the next iteration was: > > <tr> > <%form_remote_for :time_record, :url => { :action => "add_time_record" > } do |f| %> > <% f.date_select(:day, :disabled => true, :order => [:day, :month]) > %> > <td><%= f.date_select(:day, :order => [:day, :month]) %></td> > <td><%= f.collection_select(:user_id, @users, :id, :login_name) > %></td> > <td><%= f.collection_select(:project_id, @projects, :id, :name) > %></td> > <td><%= f.text_field :quantity, :size => 4 %></td> > <td><%= f.text_field :description, :size => 50 %></td> > <td><%= submit_tag "Zeit Erfassen" %></td> > <% end %> > </tr> > > Which did not work.This''ll work if you instead write something like: <tr id="time_record"> <% fields_for :time_record do |f| %> <td><%= f.date_select :day, :disabled => true, :order => [:day, :month] %></td> <td><%= f.date_select :day, :order => [:day, :month] %></td> <td><%= f.collection_select :user_id, @users, :id, :login_name %></td> <td><%= f.collection_select :project_id, @projects, :id, :name %></td> <td><%= f.text_field :quantity, :size => 4 %></td> <td><%= f.text_field :description, :size => 50 %></td> <td><%= submit_to_remote :commit, "Zeit Erfassen", :submit => :time_record, :url => {:action => "add_time_record"} %></td> <% end %> </tr>> In my opinion, form_for and form_remote_for should behave the same way.They do. You''re lucky your first form_for version worked at all. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for your post - really great. I was just on the wrong way, now it just works fine. Best regards, Andor -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---