form question.

8 views
Skip to first unread message

Joe Guerra

unread,
Nov 11, 2017, 1:59:59 PM11/11/17
to Ruby on Rails: Talk
I have just added qty to a product page.

I think I need to somehow put the button_to into the form, but it's working ok now.  

I'd like to pass in an instant variable @remaining into the max form element instead of using a fixed value there now (5).

I think I tried max = "<% @remaining %>", but that didn't work.  Not sure how that is passed into a form element.

<form>
Quantity:
<input type="number" name="quantity" value="1" min="1" max= "5" ><br>

</form>
<%= button_to "Add to Cart", { :controller => "products", :action => "add_to_cart", product_id: @product } %>

Joe Guerra

unread,
Nov 11, 2017, 2:02:18 PM11/11/17
to Ruby on Rails: Talk
ok, nevermind.  I figured it out , I removed the " ".
Reply all
Reply to author
Forward
0 new messages