Denes,
No it isn't. When I expose the function, it doesn't throw an error, so
I haven't got a clue why it isn't working. Here's my code, I hope you
see why it isn't working (Compared to my code above I changed #city to
#plaatsnaam, captitalize() to capitalize() and def cityAC to def
cityAC: but that didn't solve the problem)
In fitwise_ajax.html:
<link href="{{=URL(r=request,c='static',f='css/
jquery.autocomplete.css')}}" rel="stylesheet" type="text/css"
media="screen" charset="utf-8" />
<script src="{{=URL(r=request,c='static',f='scripts/
jquery.autocomplete.js')}}" type="text/javascript"></script>
and in the $(document).ready(function() {}:
$('#plaatsnaam').autocomplete('/b2c/handlers/cityAC',{maxItemsToShow:
12});
The form_factory form in my controller:
form=form_factory(SQLField('plaatsnaam',label='Type een
plaatsnaam',requires=IS_NOT_EMPTY(),\
widget=lambda self, value:TAG[''](
INPUT
(_id='plaatsnaam',_name='plaatsnaam',_class='ac_input',_type='text'))))
The function in my handlers.py:
def cityAC():
q=''
if request.vars:
q=request.vars.q
if not q:
return q
rows=db(db.adres.plaatsnaam.like(request.vars.q.capitalize()+'%s%
%'%q))\
.select(db.adres.plaatsnaam,distinct=True)
r=''
for row in rows:
r='%s%s'%(r,row.option)
return r
Best regards,
Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---