Not sure I fully understand your requirements, but maybe: requires=IS_IN_SET(..., multiple=(0, MAX_SIZE_OF_SET))
The "multiple" arguments indicates multiple items can be selected, and it can either be a boolean or a list/tuple specifying a minimum and maximum number of values. In the latter case, the minimum can be 0, allowing an empty set. Anthony On Monday, October 22, 2018 at 11:07:14 PM UTC-4, Chris V. wrote: > > Hello list, > > I need to have 2 requires in the same field, one requires must be a select > multiple, but also it can be a different value of initial select multiple, > this because in the view the select multiple values are changed with > javascript . > > It is possible to make something like the following?: > Field("Grado", default=grados_roca[2],* requires=IS_NOT_EMPTY() > OR IS_IN_SET(range(2, (len(grados_roca) + 1)), grados_roca)), ??* > > And if is possible, how could I make this ? > > > I tryied with this but i had no lucky: > Field("Grado", default=grados_roca[2], requires=[IS_NOT_EMPTY(), > IS_IN_SET(range(2, (len(grados_roca) + 1)), grados_roca))]), > > this is my sql form: > > SQLFORM.factory(Field("nombre_ruta", requires=IS_NOT_EMPTY()), > Field("Modalidad", > default=modalidades[1],requires=IS_IN_SET(modalidades)), > Field("Tipo", > default='Monolargo', requires=IS_IN_SET(tipo)), > Field("Grado", > default=grados_roca[2], requires=IS_IN_SET(range(2, (len(grados_roca) + > 1)), grados_roca)), > Field("Largos", default="3", > > requires=IS_IN_SET(range(1, 51))), > Field("Zona", > default=zonas_list[0], > > requires=IS_IN_SET(zonas_list, zonas_list_name)), > Field("Observacion", > 'text', length=300, > default='No se han > registrado observaciones', label="Observaciones"), > _name="agregar_ruta", > submit_button="Agregar", > ) > > > Cheers! > Chris. > -- 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.