I tried this in a controller and worked fine: def factory(): options = ['a','b','c'] form = SQLFORM.factory(Field('Optimizers', requires=IS_IN_SET(options,multiple='multiple'))) if form.accepts(request.vars, session): response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form = form, form_options = form.vars.Optimizers)
Note that according to the web2py book: "The elements of the set must always be strings unless this validator is preceded by IS_INT_IN_RANGE (which converts the value to int) or IS_FLOAT_IN_RANGE (which converts the value to float)" I have also 2 questions though if somebody can help: 1. If nothing is selected why the form is accepted? 2. If I try to use multiple validators in requires=[] of the SQLFORM.factory, only the last validator of the 'requires' list is enforced. Is this a bug? The tried code is: form=SQLFORM.factory(Field('Optimizers',requires=[IS_IN_SET(options,multiple='multiple'), IS_NOT_EMPTY()] )) On 16 Νοέ, 18:39, Lorin Rivers <lriv...@mosasaur.com> wrote: > Actually, that block prevents the query from running when the page loads. >