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:
<%form_for :time_record, :url => { :action => "add_time_record" } do
|f| %>
<% f.date_select(:day, :disabled => true, :order => [:day, :month])
%>
<%= 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", :class => "submit" %> |
<% end %>
Works fine.
Iterating in small steps to AJAX, the next iteration was:
<%form_remote_for :time_record, :url => { :action => "add_time_record"
} do |f| %>
<% f.date_select(:day, :disabled => true, :order => [:day, :month])
%>
<%= 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 %>
Which did not work. Changing the whole thing to
<%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 %>
|
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 ?