You are returning a dictionary here which web2py renders as an HTML
table, you need to return a SELECT.
>
> and a view like this:
>
> {{extend 'layout.html'}}
>
> <script type="text/javascript"><!--
> function myajax(u,s,t) {
> var query="";
> for(i=0; i<s.length; i++) { if(i>0) query=query+"&";
> query=query+encodeURIComponent(s[i])
> +"="+encodeURIComponent(document.getElementById(s[i]).value);
> }
> $.ajax({type: "POST", url: u, data: query, success: function(msg)
> { document.getElementById(t).value=msg; } });
Should be:
{ document.getElementById(t).innerHTML=msg; } });
> }
>
> //--></script>
>
> <table>
> <tr>
> {{=SELECT(_onChange="myajax({{=URL(r=request,f='getspecies')\}\},
> ['species'],'species');",*[OPTION(genera[i].name,
Should be:
{{=SELECT(_onChange="myajax('"+URL(r=request,f='getspecies')+"',
> _value=str(genera[i].id)) for i in range(len(genera))])}}
> </tr>
> <tr>
Your myajax call is trying to inject the select into itself, you need to
inject into the parent element:
<div id="target">
> {{try:}}
> {{=SELECT(_id='species',*[OPTION(species[i].name,
> _value=str(species[i].id)) for i in range(len(species))])}}
> {{except:}}
> {{=P('Failed')}}
> {{pass}}
<div>
Cheers, Stuart