from the book IS_IN_SET and Tagging
The IS_IN_SET validator has an optional attribute multiple=False. If set to True, multiple values can be stored in one field. The field should be of type list:integer or list:string. multiple references are handled automatically in create and update forms, but they are transparent to the DAL. We strongly suggest using the jQuery multiselect plugin to render multiple fields. Note that when multiple=True, IS_IN_SET will accept zero or more values, i.e. it will accept the field when nothing has been selected. multiplecan also be a tuple of the form (a,b) where a and b are the minimum and (exclusive) maximum number of items that can be selected respectively. On Wednesday, July 8, 2015 at 4:36:29 PM UTC+2, Francisco Costa wrote: > > Hi, > > Is there any validator for a List size? > > db.define_table( > 'categories', > Field('id', required=True, unique=True), > Field('name', 'string', length=128, required=True), > ) > > db.define_table( > 'sub_categories', > Field('id', required=True, unique=True), > Field('name', 'string', length=128, required=True), > Field('main_categories', 'list:reference categories', required=True), > ) > > Is it possible to limit the minsize and/or maxsize of main_categories? > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.