Hi Annet, On Apr 13, 3:54 am, jmverm...@xs4all.nl wrote: > Massimo, > > >SQLField(...widget=...) > >there are some examples in gluon/sqlhtml.py but your way of doing it > >is the easiest way. > > I think I prefer the widget, the easiest way is not always the most > beautiful way. I had a look at the gluon/sqlhtml.py file, I suppose > the OptionsWidget is the one I need.
form_factory already gives you the dropbox using the OptionsWidget. Do you want something different?. > > The widget should be based on the following table: > > db.define_table('event', > SQLField('...'), > SQLField('sleutelwoord', length=24), > SQLField('...'), > migrate=False) > > db.event.sleutelwoord.requires=IS_IN_DB(db, > db.sleutelwoord.sleutelwoord, '%(sleutelwoord)s') form=form_factory( SQLField( 'sleutelwoord',requires=IS_IN_DB(...) ) ,labels={'sleutelwoord','Selecteer een sleutelwoord'} ) But if you want distinct=True then you have to use IS_IN_SET as in your original post. BTW, instead of: keywordlist=[keywordrows[i]['sleutelwoord'] for i in range(len (keywordrows))] you can do: keywordlist=[k['sleutelwoord'] for k in keywordrows] > > From gluon/sqlhtml.py I can't derive what the widget should read like: > > widget=lambda self, value:INPUT > (_id='...',_name='sleutelwoord',_class='OptionsWidget',_type='text') > > I hope one of you will help me fill the gaps. > > Kind 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 web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---