I need to auto-populate my 'ranks' drop-down based on the value selected in
the 'department' one.
This is my script:
<script>
$("#department").change(function() {
$("#ranks").load("?dpt=" + $("#department").val());
});
</script>
As you can see, I pass *dpt *var to my current function. This is it's code:
def add_experience():
ranks = db(db.rank.department_id ==
request.vars.dpt).select(orderby=db.rank.name)
result = ""
for r in ranks:
result += "<option value='" + str(r.id) + "'>" + r.name +
"</option>"
return dict(result=XML(result))
When I select a value in the first drop-down, a request is being sent to
[controller]/add_experience?dpt=[value selected]. However the second
drop-down does not populate with respective data - it's empty. I'm clearly
missing something. Any help?
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.