or
db.Field('gender', requires = IS_IN_SET(
['male', 'female'],['Handsome man','Pretty woman']))
to preserve order.
Notice that 'gender' is more appropriate than 'sex'.
Massimo
On Jun 2, 7:55 am, Iceberg <[email protected]> wrote:
> You can also try this:
>
> db.Field('sex', requires = IS_IN_SET(
> {'male':'Handsome man', 'female':'Pretty woman'}
> ))
>
> On Jun2, 8:24pm, Mladen Milankovic <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---