Ok, I am stupid! :P I was overwriting the value of the zero field with *form.custom.widget.just_a_dropdown[0] = 'new_value'* . This was messing up the validation, obviously. Thank you for your help Massimo.
Have a nice day, David On 6 November 2012 16:30, Massimo Di Pierro <[email protected]>wrote: > 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]>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_**cho**ice' >>>> : '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 >>>> >>> -- >>> >>> >>> >>> >> >> -- > > > > --

