Hmm I'm not sure you have given enough info.  Anyhow:

Check in Firebug whether the load function is being triggered.
Place print statements in your function to test that the variables are 
being set.
Bear in mind that "return dict(...)"  will render a complete page layout.  
I wonder if that is what you want? 
Check out the SELECT and OPTION helpers.


On Sunday, 16 June 2013 23:10:12 UTC+1, lesssugar wrote:
>
> 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 its 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to