form question.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

form question.

Joe Guerra
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 } %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1bac03f4-02c6-496f-a8dd-59abe52bd911%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: form question.

Joe Guerra
ok, nevermind.  I figured it out , I removed the " ".

On Saturday, November 11, 2017 at 1:59:59 PM UTC-5, Joe Guerra wrote:
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 } %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/70c67ad4-5830-4f62-ae19-327003879145%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.