What happens if you reverse the order of the validators:

Mytable.payday.requires = [
    IS_IN_SET(G_DAYS_AVAILABLE, error_message="Choose one day"),
    IS_INT_IN_RANGE(0,31)]
Or what happens if you leave out the IS_INT_IN_RANGE validator altogether?

Anthony
On Tue, Dec 6, 2011 at 3:27 PM, Vinicius Assef <vinicius...@gmail.com>wrote:

> Guys, I need some help with IS_INT_IN_RANGE() plus IS_IN_SET() validators.
>
> I have the following structure, to adjust Mytable.payday.requires:
>
> [code]
> G_DAYS_AVAILABLE = [
>   (1, "Day 1st"),
>   (5, "Day 5th"),
>   (10, "Day 10th")]
>
> Mytable.payday.requires = IS_IN_SET(G_DAYS_AVAILABLE,
>        error_message="Choose one day")
> [/code]
>
> This code works fine. But Mytable.payday field is integer. So,
> according to the book [1], I must precede IS_IN_SET() with
> IS_INT_IN_RANGE().
>
> [code]
> Mytable.payday.requires = [
>    IS_INT_IN_RANGE(0,31),
>    IS_IN_SET(G_DAYS_AVAILABLE,
>        error_message="Choose one day")]
> [/code]
>
> This code generates a ticket reporting this error:
> SyntaxError: widget cannot determine options of no_table.payday
>
> I am using SQLFORM.factory() with web2py 1.99.2 (last stable)
>
> Where's my error? Any ideias?
>
> [1] http://web2py.com/book/default/chapter/07#Validators
>
> --
> Vinicius Assef
>

Reply via email to