Hi Alan,

Thanks for your replies. They pointed me in the right direction to
solve the multiselect problem. I am left with one small problem.

The form that contains the multiselect also contains an autocomplete
function:

def index():
    ....
    form=SQLFORM.factory(
        Field('word',label='Trefwoord',length=128,requires=\
 
IS_IN_DB(db(db.NetworkKeyword.networkID==session.hubnetworkID),db.NetworkKeyword.word,'%
(word)s',\
        zero='Select a value')),
 
Field('locality_args',label='Plaats',length=64,requires=IS_NOT_EMPTY()),separator=False)
    ....
    return dict(form=form,rows=rows)


def locality_args_autocomplete():
 
rows=db((db.NodeKeyword.word==request.args(0))&(db.NodeKeyword.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)


.... and in the view:


<script type="text/javascript">
$(function() {
  $("#no_table_locality_args").autocomplete({
    source: "{{=URL('hubaddressbook',
'locality_args_autocomplete',args='javascript:$
(select#no_table_word).val();')}}",
    minLength: 2
  });
});
</script>

... which gives me an invalid path (args) error.


When I set args='software engineer' in the source and
db.NodeKeyword.word=='software engineer' in the
locality_args_autocomplete() function, the code works, however, with
form.vars.word in the view and request.args(0) in the function it
doesn't. Do you know with what code I have to replace 'software
engineer' to get both functions to work.


Kind regards,

Annet.

Reply via email to