You can also try this: db.Field('sex', requires = IS_IN_SET( {'male':'Handsome man', 'female':'Pretty woman'} ))
On Jun2, 8:24pm, Mladen Milankovic <mml...@gmail.com> wrote: > Hi. > > You don't need the [] brackets. > use: > db.define_table('user', > db.Field('sex', requires = IS_IN_SET(['male', 'female']))) > > regards > mmlado > > On Tuesday 02 June 2009 13:39:35 durga wrote: > > > hi > > > I would like create a form through SQLFORM in which one of my field to > > be generated as combo box. for example i have options male/female for > > a sex field. How do i write code for this. > > > db.define_table('users', > > SQLField('sex',requires=[IS_IN_SET > > (['male','female'])]) > > > thanks in advance --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---