How about IS_EMPTY_OR(IS_IN_SET(....,zero=''))
On Tuesday, 6 November 2012 08:31:49 UTC-6, David Sorrentino wrote: > > Hi Massimo, and thank you for your reply. :) > > I had already tried requires=IS_EMPTY_OR(IS_IN_SET(....)) and it seems not > to work. The form is not accepted because the selected value is not in the > set. > Perhaps I am missing something!? > > Cheers, > David > > > On 6 November 2012 14:42, Massimo Di Pierro > <[email protected]<javascript:> > > wrote: > >> requires=IS_EMPTY_OR(IS_IN_SET(....)) >> >> >> On Tuesday, 6 November 2012 06:46:24 UTC-6, David Sorrentino wrote: >>> >>> Hey there! :) >>> >>> Other day, other doubt. :P >>> >>> In my controller I define a form with SQLFORM.factory. This form >>> contains a dropdown. >>> Here is the code. >>> def mansioni(): >>> form = SQLFORM.factory( >>> Field('just_a_dropdown', requires=IS_IN_SET({'first_**choice': >>> 'First >>> choice', 'second_choice': 'Second choice'}, zero='Please, make your >>> choice...')) >>> ) >>> return dict(form=form) >>> >>> My problem is that, understandably, one of the two values must be >>> selected, otherwise the form will not be accepted. >>> So the question is: is there any way to make this dropdown optional? >>> >>> Best, >>> David >>> >> -- >> >> >> >> > > --

