Hello,

Thanks for all the replies. I've used this format before in .Net using
a datagrid, but I'm tring to apply it to RoR. Fred, if the issue is
repeated parameter in a single form, am I best off attempting to add
'fields_for' to the form, or is there a way to make every row iterate
on multiple forms, like placing @item.each do outside the form (I
would assume this would not work.)
Thanks Colin, once I get a functional page, I'll validate it.

max

On Sep 6, 10:06 am, Colin Law <[email protected]> wrote:
> 2009/9/6 maximulus <[email protected]>:
>
>
>
>
>
>
>
> > Hello,
>
> > I'm clearly missing some bit of code, but I can't figure out what.
> > There are three models: Invoice, Lineitems and items. I want the user
> > to search a list of items, and then add them to the lineitems table.
> > The seach works, an provides a list on this form:
>
> >  <% form_for :lineitems, :url => {:action => 'create', :id=>
> > @invoice.id} do |f|-%>
> >  <table>
>
> >    <% @items.each do |item| %>
>
> >    <tr>
> >      <td><%=item.itemname %></td> <%=
> > f.hidden_field :item_id, :value=>item.id %>
>
> Probably nothing to do with your problem but I believe that input
> fields (hidden or not) are not allowed between td elements.  To check,
> view the source of the page in the browser and cut and paste the whole
> thing into the html validation service 
> athttp://validator.w3.org/#validate_by_input.  It may work ok as you
> have it in one browser but not another.  I imagine you can put it
> inside the cell.
>
> Colin
>
>
>
> >      <td><%= f.text_field :quantity %></td>
> >      <td><%= f.text_field :price, :value => item.sellprice %></td>
>
> >      <td><%= f.submit 'Add Item' %> </td>
> >    </tr>
> >      <% end %>
>
> > When you click 'Add Item', it submits for that last item on the list,
> > not the corresponding item.
>
> > Controller code for create is:
> > @invoice  = Invoice.find(params[:id])
>
> > @lineitems = @invoice.lineitems.new(params[:lineitems])- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to