Hi Anthony,

Problem of drop down's not working can be seen with the code/data posted in 
the original slice can be seen with the following changes.

*Controller :*

def index():
    grid = {}
    if request.vars.maker_name:
        query = (db.Product.Maker_ID==request.vars.maker_name)
        grid = 
SQLFORM.grid(query=query,csv=False,create=False,deletable=False,)
        lists = 
db(db.Product.Maker_ID==request.vars.maker_name).select(db.Product.ALL)
        themakers = 
db(db.Maker.id==request.vars.maker_name).select(db.Maker.ALL)      
    else:
        lists = db(db.Product.Maker_ID==1).select(db.Product.ALL)
        themakers = db(db.Maker.id==1).select(db.Maker.ALL)
    categories = db().select(db.Category.ALL)
    if request.vars.category_name:
        makers = 
db(db.Maker.Category_ID==request.vars.category_name).select(db.Maker.ALL)
    else:
        makers = db(db.Maker.Category_ID==1).select(db.Maker.ALL)
    return dict(lists=lists, categories=categories, makers=makers, 
themakers=themakers, grid=grid)


*Views:*

{{extend 'layout.html'}}
     
    <form enctype="multipart/form-data" action="{{URL()}}" method="post">
    <select name='category_name'
    onchange="jQuery('#maker_name').empty();
    ajax('maker', ['category_name'], 'maker_name');">
    {{for category in categories:}}
    <option value="{{=category.id}}"
    {{=" selected='selected'" if 
str(category.id)==request.vars.category_name else ""}}>
    {{=category.Name}}
    </option>
    {{pass}}
    </select>
     
    <select id='maker_name' name='maker_name' >
    {{for maker in makers:}}
    <option value="{{=maker.id}}"
    {{=XML(" selected='selected'") if 
str(maker.id)==request.vars.maker_name else ""}}>
    {{=maker.Name}}</option>
    {{pass}}
    </select>
    <input type="submit" value='Submit'>
    </form>
     
{{=grid}}


Now when the results are displayed in the grid, on selecting the view 
option (you may have to click on submit again to view the results). After 
view grid record option is used, changes made in drop down's are not 
reflected upon submit i.e if the product name is changed from the drop 
down, new grid results are not seen.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to