I just added to trunk...

<span id="there">quantity</span>
{{=A('add
product',callback=URL('add_product',args='id'),target='there))}}

On Apr 25, 2:53 pm, pbreit <pbreitenb...@gmail.com> wrote:
> And I just noticed that you are going to run into some intricacy with how to
> implement the quantity selector.
>
> You'll either need to create a <form> for each toy (in which case each toy
> will also have its own "add to cart" button) or you will have to identify
> each quantity form field which might make it tough to use the FORM()
> function to create the form.
>
> You might need to do something like this in the view:
>
> <form method=GET action={{=URL('add_to_cart')}}>
> {{for toy in toys:}}
>     {{=toy.name}} <input name=qty{{=toy.id}}>
> {{pass}}
> <input type=submit value="Add To Cart">
> </form>
>
> Then in the "add_to_cart()" controller, you're going to need to look at all
> the "qty1", "qty2", etc to figure out which toy has a quantity specified
> (and parse out the toy.id).
>
> As you may have figured out, there are quite a number of different ways to
> implement forms in Web2py. Massimo's suggestion to use Ajax might also be a
> good approach.

Reply via email to