Hi Jim,

Thanks for you reply.

I've been working on this function on and off, so far this works:

In the view:

<script type="text/javascript">
$(function() {$("#no_table_name").autocomplete({source: "{{=URL('jqueryui', 
'organization_autocomplete')}}", minLength: 2});});
$(function() {$("#no_table_tag").autocomplete({source: "{{=URL('jqueryui', 
'nodetag_autocomplete')}}", change: function() 
{$("#no_table_name").val('');}, minLength: 2});});
$(function() {$("#no_table_locality").autocomplete({source: 
"{{=URL('jqueryui', 'addresslocality_autocomplete')}}", minLength: 2});});
</script>

I think $.post() is the best way to get the value of no_table_tag to the 
function addresslocality_autocomplete(), something like:

$.post("{{=URL('jqueryui', 'addresslocality_autocomplete')}}", { tag: 
$("#no_table_tag").val('');} );


and the function in the controller

def addresslocality_autocomplete():
    rows = db((db.node_tag.tag=='request.vars.tag) & 
(db.node_tag.nodeID==db.address.nodeID)
              
&(db.address.locality.like(request.vars.term+'%'))).select(db.address.locality, 
distinct=True,
                                                                         
orderby=db.address.locality).as_list()
    result = [r['locality'] for r in rows]
    return response.json(result)


I tried several events to trigger  $.post () but none of them worked. How 
do I trigger $.post() to pass
the value of no_table_tag to the function?


Regards,

Annet

-- 
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