you have to add db.table.field.default=0

On May 15, 9:26 pm, Richard <[email protected]> wrote:
> thanks for that.
>
> I found if the range includes negative numbers such as
> IS_IN_SET(range(-5, 6), zero=None), and the field value is 0, then
> SQLFORM will select the first entry (-5) rather than 0.
>
> On May 16, 2:46 am, Iceberg <[email protected]> wrote:
>
> > 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

Reply via email to