Massimo,

thank you very much for your example, but it does not work, here is my 
complete code:

model:
db.define_table('cities',
    Field('name'),
    Field('mystate'),
    format = '%(name)s'
)
#db.cities.requires=IS_IN_DB(db, 'cities.id', 
'%(name)s')#IS_IN_DB(db,db.cities.id,'%(name)s')

controller:
def insertData():
    if db(db.cities.id>0).count() == 0:
        db.cities.truncate()
        db.cities.insert(name='Cityname1',mystate='State1')
        db.cities.insert(name='Cityname2',mystate='State2')
        db.cities.insert(name='Cityname3',mystate='State2')
        db.cities.insert(name='Cityname4',mystate='State3')
        db.cities.insert(name='Cityname5',mystate='State3')

def menuFromDb():
    form = SQLFORM.factory(Field('choose_city','reference cities')) 
 #reference cities, db.cities
    #form = SQLFORM.factory(Field('choose_city','db.cities'))
    return dict(form=form)

View:
{{extend 'layout.html'}}
{{=form}}


This code produce only a simple imput box and not a drop down menu, that 
comes from the db as intended.

I think, only one line of code is missing, but what?

Thanks for your help and your great work with web2py!

pd

-- 
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/groups/opt_out.

Reply via email to