Can I create check boxes for IS_IN_DB() validator drop down menu?

66 views
Skip to first unread message

mostwanted

unread,
Feb 18, 2021, 11:59:30 PM2/18/21
to web2py-users
Hi guys, I was wondering if there is a way to create checkboxes for the IS_IN_DB() validator & be able to select several options at a go like I can with IS_IN_SET().

Example:

db.define_table('favourites',
                Field('snack'),
                format="%(snack)s")

db.define_table('person',
                Field('Name'),
                Field('favourites', 'reference favourites', requires=IS_IN_DB((db, db.favourites, '%(snack)s'),multiple=True), widget=SQLFORM.widgets.checkboxes.widget))

If the above is not possible what can i do to achieve the same results?

Regrads,

Mostwanted

Dave S

unread,
Mar 9, 2021, 1:56:23 PM3/9/21
to web2py-users
In the Chap 7 discussion of IS_IN_BOOT,
 there's a paragraph beginning

"If you want the field validated, but you do not want a drop-down, you must put the validator in a list
[...] Occasionally you want the drop-down "

Does that section help with your question?

/dps


Reply all
Reply to author
Forward
0 new messages