# \[\]Help with form\_for

**URL:** <https://www.ruby-forum.com/t/help-with-form-for/133109>\
**Category:** Rails\
**Created:** [March 27, 2008, 9:05pm UTC](https://www.ruby-forum.com/t/help-with-form-for/133109 "2008-03-27T21:05:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 27, 2008, 9:05pm UTC](https://www.ruby-forum.com/t/help-with-form-for/133109/1 "2008-03-27T21:05:46Z")

</div>

I have this rhtml, that generate a table with the object @evaluations  
filled it before. The problem is that i need to get those text\_field  
with the data loaded, but instead it’ filled all text\_field whit the  
last @evaluation.  
What i am doing wrong?

\<% form\_for( @evaluations ) do |f| %\>

\<% for evaluation in @evaluations %\>  
\<%= evaluation.id%\>

  
  

```
  <td><%=f.text_field(:id, :size => 2) %></td>
  <td><%=f.text_field(:first_evaluation, :size => 2) %></td>
  <td><%=f.text_field(:second_evaluation, :size => 2) %></td>
  <td><%=f.text_field(:final_evaluation, :size => 2) %></td>

  <td><%= link_to 'Show', evaluation %></td>
  <td><%= link_to 'Edit', edit_evaluation_path(evaluation) %></td>
  <td><%= link_to 'Destroy', evaluation, :confirm => 'Are you

```

sure?’, :method =\> :delete %\>

  
\<% end %\> 

| Student | Commission | Id | Parcial 1 | Parcial 2 | Final |
| --- | --- | --- | --- | --- | --- |
| \<%=h evaluation.student.fistName %\> | \<%=h evaluation.commission.code %\> |

\<%= f.submit "Update" %\>

\<% end %\>

Thanks you much for your help.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 28, 2008, 12:37am UTC](https://www.ruby-forum.com/t/help-with-form-for/133109/2 "2008-03-28T00:37:28Z")

</div>

On 27 Mar 2008, at 20:04, removed\_email\_address@domain.invalid wrote:

> I have this rhtml, that generate a table with the object @evaluations  
> filled it before. The problem is that i need to get those text\_field  
> with the data loaded, but instead it’ filled all text\_field whit the  
> last @evaluation.  
> What i am doing wrong?

form\_for binds a form builder to one particular object, so trying to  
use it to display text\_fields for multiple objects isn’t going to  
work. If you’re set on using a single form, you might want to look at  
fields\_for (fields\_for gives you a form builder much like what you  
would get from form\_for but just generates the input tags.

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 28, 2008, 10:27am UTC](https://www.ruby-forum.com/t/help-with-form-for/133109/3 "2008-03-28T10:27:52Z")

</div>

Thanks,!  
I founded it text\_field\_tag, i don’t know if is the best way, but in the  
controller i used:  
first\_evaluation = params[:first\_evaluation]  
Then i fill the values with those values.In the view i used:  
\<%= text\_field\_tag(“first\_evaluation[]”, evaluation.first\_evaluation,  
:size  
=\> 2 ). What do you thing about it?

Sallu2…

On Thu, Mar 27, 2008 at 8:36 PM, Frederick C. \<
