I'm in the same problem , so please ... help us .
On 5 ago, 16:48, Sophie <kfarron...@gmail.com> wrote:
> Hi i read the page and i don't understand it too much. i wrote this
> code, it is working but i have this problem. the first combo is
> working fine, the second appears with the correct data, when i select
> the combo in the page appears the third combo with the correct data,
> but the problem is that the second combo disappear. What can i do so
> the second combo don't disappear. Here is my code:
>
> controller:
> def index():
> productType = db().select(db.productType.ALL)
> return dict(productType=productType)
>
> def getproduct():
> productType = request.vars.values()[0]
> product = db(db.product.productTypeId == productType).select()
> return SELECT( _id='product', _onChange="ajax('"+URL
> (r=request,f='getsales')+"', ['product'], 'target');", *[OPTION(product
> [i].nProduct, _value=str(product[i].id)) for i in range(len
> (product))])
>
> def getsales():
> product = request.vars.values()[0]
> sales = db(db.sales.productId == product).select()
> return SELECT(_id='sales',*[OPTION(sales[i].nSales, _value=str
> (sales[i].id)) for i in range(len(sales))])
>
> view:
> {{extend 'layout.html'}}
> <table>
> <tr>
> {{=SELECT( _id='productType', _onChange="ajax('"+URL
> (r=request,f='getproduct')+"'
> , ['productType'], 'target');", *[OPTION(productType
> [i].nProductType,_value=str(productType[i].id)) for i in range(len
> (productType))] )}}
> </tr>
> <tr>
> <div id="target"> <div>
> </tr>
> </table>
>
> I hope you can help me. Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---