IS_IN_SET handle dictionary

27 views
Skip to first unread message

Yebach

unread,
Sep 3, 2018, 6:02:55 AM9/3/18
to web2py-users
Hello

Is it possible to use validator IS_IN_SET to handle dictionary. I want to send a list of dicts for user to select [{"id": 1, "m:code": C-111}, {"id": 2, "m:code": BC-222},.....], so when I use on_validate I can handle with id.

Thank you

Anthony

unread,
Sep 3, 2018, 10:44:17 AM9/3/18
to web2py-users
It is documented here: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Range-set-and-equality-validators. Assuming you want separate values and labels, you can use a dictionary or list of tuples (not a list of dictionaries as you have, though).

Anthony

Leonel Câmara

unread,
Sep 3, 2018, 1:53:00 PM9/3/18
to web2py-users
What Anthony said. But, shouldn't you be using IS_IN_DB for this?
Reply all
Reply to author
Forward
0 new messages