Yes my code is from web2py slices
I have the following view :-
{{left_sidebar_enabled,right_sidebar_enabled=True,False}}
{{extend 'adminlayout.html'}}
<div id="contdoc">
<h4>Themis Project Console</h4>
</div>
<div id="contdoc">
<form name="assign"
action="{{=URL('default','admin_submit_assign_project')}}" method="post"
onsubmit="return showcnf()" >
Select Organization : <select name='org_name'
onchange="ajax('admin_assign',['org_name'],'shadow_clone');">
{{for org in organization:}}
<option value="{{=org.organization}}" >
{{=org.organization}}
</option>
{{pass}}
</select>
</br>
Select Department : <select name='category_name'
onchange="jQuery(maker_name).remove();
ajax('admin_assign_pro', ['category_name'], 'shadow_clone');">
{{for category in categories:}}
<option value="{{=category.category}}"
{{=" selected='selected'" if
str(category.category)==request.vars.category_name else ""}}>
{{=category.category}}
</option>
{{pass}}
</select>
<span id='shadow_clone'></span>
</br>
Select Employee Email : <select name='maker_name'>
{{for maker in makers:}}
<option value="{{=maker.email}}"
{{=XML(" selected='selected'") if
str(maker.email)==request.vars.maker_name else ""}}>
{{=maker.email}}
</option>
{{pass}}
</select>
</br>
<input type="submit" value="Submit" />
</form>
<hr>
</div>
<div id="contdoc">
{{=form}}
</div>
and the following Controller :-
def admin_assign_project():
for row2 in db(db.image.email == auth.user.email).select():
images=row2.image
db.assign_project.id.readable=False
form=SQLFORM.grid(db.assign_project)
projects=db().select(db.admin_add_project.ALL)
organization=db().select(db.auth_user.ALL)
categories = db().select(db.category.ALL)
if request.vars.org_name:
makers =
db(db.auth_user.organization==request.vars.org_name).select(db.auth_user.ALL)
else:
makers = db(db.auth_user.organization=='').select(db.auth_user.ALL)
return dict(organization=organization,categories=categories, makers=makers,
images=images, form=form)
def admin_assign():
makers =
db((db.auth_user.organization==request.vars.org_name)).select(db.auth_user.ALL)
result = "<select name='maker_name'>"
for maker in makers:
result += "<option value='" + str(maker.category) + "'>" +
str(maker.category) + "</option>"
result += "</select>"
return XML(result)
def admin_assign_pro():
makers =
db((db.auth_user.department==request.vars.category_name)).select(db.auth_user.ALL)
result = "<select name='maker_name'>"
for maker in makers:
result += "<option value='" + str(maker.email) + "'>" +
str(maker.email+'\t'+'('+maker.first_name+'\t'+maker.last_name+')') +
"</option>"
result += "</select>"
return XML(result)
Here I want to value in second drop-down category_name filtered on the
first drop-down org_name which are selected and the value in the third
drop-down maker_name filtered on the second drop-down which will be
selected via ajax.
I am getting the value only in the second drop-down but i am not be able to
get the value in the third drop-down filtered on the second . Thanks in
advance .