# Form\_remote\_for, reloaded

**URL:** <https://www.ruby-forum.com/t/form-remote-for-reloaded/92938>\
**Category:** Rails\
**Created:** [April 25, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/form-remote-for-reloaded/92938 "2007-04-25T21:56:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 25, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/form-remote-for-reloaded/92938/1 "2007-04-25T21:56:11Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 25, 2007, 11:11pm UTC](https://www.ruby-forum.com/t/form-remote-for-reloaded/92938/2 "2007-04-25T23:11:32Z")

</div>

Andor Greißl wrote:

> ```
> <td><%= 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.

This’ll work if you instead write something like:

\<% fields\_for :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\_to\_remote :commit, "Zeit Erfassen", :submit =\> :time\_record, :url =\> {:action =\> "add\_time\_record"} %\> \<% end %\>

> 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.

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 26, 2007, 7:45am UTC](https://www.ruby-forum.com/t/form-remote-for-reloaded/92938/3 "2007-04-26T07:45:54Z")

</div>

Thanks for your post - really great. I was just on the wrong way, now it  
just works fine.

Best regards,  
Andor
