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
>
--