Exactly. Complete code in case you have errors:
#model
db.define_table('persons',Field('gender'))
db.persons.gender.requires = IS_IN_SET(['Male', 'Female'])
#controller default.py
def index():
form = SQLFORM(db.persons).process()
return locals()
#views default/index.html
{{extend 'layout.html'}}
{{=form}}
Mind we tend to call table names with singular not plural (person, not
persons). This will make your code more readable.
On Friday, 26 July 2013 02:57:21 UTC-5, viniciusban wrote:
>
> It's done automaticaly by web2py.
>
> On Fri, Jul 26, 2013 at 2:29 AM, Sarbjit singh
> <[email protected]<javascript:>>
> wrote:
> > I have a db where I have set validator IS_IN_SET on a particular field.
> I am
> > generating table rows (to be used as form), so I need to check if a
> > particular field is having IS_IN_SET validator set and I want to
> retrieve
> > the set values. Reason I want to do this is that I am generating a
> dynamic
> > form based on the table fields and for the fields having IS_IN_SET
> validtor,
> > I want to show the "Drop Down" menu rather than Text Field and wants to
> > populate it with the Validator values.
> >
> > db.define_table('persons',Field('gender')
> > db.persons.gender.requires = IS_IN_SET(['Male', 'Female'])
> >
> > -Sarbjit
> >
> > --
> >
> > ---
> > 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 [email protected] <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.