On Sep 13, 9:56 pm, Dudebot <[email protected]> wrote:
> I'm almost there... if someone could please help me :)
>
> OK, if I have this in my .html.erb:
>
> <%= button_to "Add to Cart" , :action => 'add_to_cart', :id =>
> item, :amount => 3 %>
>
> I get proper behavior.  But I'm trying to figure out how to wire up a
> text field for :amount
>
> <%= text_field_tag '$', @amount %></p>
> <%= button_to "Add to Cart" , :action => 'add_to_cart', :id =>
> item, :amount => @amount %>
>
> Doesn't work.  Does anybody have an idea of what would?
>
You need a form. What button_to does is create a form containing just
a button, whereas you  need a form containing both the textfield and
the submit button


Fred
> add_to_cart is now working with
>
>   def add_to_cart
>     item = Item.find( params[ :id ] )
>     @cart = find_cart
>     @cart.add_item( item, params[ :amount ] )
>   end
>
> Can anyone help??
>
> Many TIA,
> Craig
--~--~---------~--~----~------------~-------~--~----~
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