I am trying to get an auto_complete field to work based on the
following table:


db.define_table('zipcoderegions',
    SQLField('region', type=integer, default='',notnull=True),
    SQLField('codemin', type=integer, default='', notnull=True),
    SQLField('codemax', type=integer,, default='', notnull=True),
    migrate=False)


In web2py_ajax I have got:

$('#byzipcode').autocomplete('/core/handlers/byzipcodeAC',
{maxItemsToShow:12});


In the form:

form=form_factory(SQLField('postcoderegio',requires=IS_NOT_EMPTY(),\
    widget=lambda self,value:TAG[''](INPUT
(_id='byzipcode',_name='postcoderegio',_class=\
'ac_input',_type='text'))))


and in /core/handlers/

def byzipcodeAC():
    q=''
    if request.vars:
        q=request.vars.q
    if not q:
        return q
    rows=db(db.zipcoderegions.region.like('%s%%'%q)).select
(db.zipcoderegions.region)
    r=''
    for row in rows:
        r='%s%s\n'%(r,row.region)
    return r


Does this have anything do to with region being of type integer, if
so, how do I solve the problem, if not, why isn't this working?


Thanks,

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

Reply via email to