On May15, 11:14pm, Jose <[email protected]> wrote:
> On 15 mayo, 10:58, Richard <[email protected]> wrote:
>
> > I want the user to select an integer between a certain range (their
> > birth year) . IS_INT_IN_RANGE provides the restriction but uses an
> > input box - how can I get SQLFORM to use a select box for this integer
> > range?
>
> > Richard
>
> This helps you?
>
> .requires = IS_IN_SET([x for x in range(1, 4)], zero=None)
>
> Jose
Why bother the [x for x in ...] ? Just do
requires = IS_IN_SET(range(1, 4))
And in case that list is quite large, the alternative is:
Field('a_large_number', 'integer',
requires = IS_INT_IN_RANGE(minimum=1, maximum=100000),
comment = 'NOTICE: Input something between 1 and 100000')
Iceberg