On Nov 3, 3:52 pm, andrej burja <andrej.bu...@gmail.com> wrote:
> hi
>
> why is order of validators important?
> i have
>
> db.tecaj.voditelj.requires=IS_NOT_EMPTY()
> db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s')
>
> why does putting the IS_NOT_EMPTY() at the end doesn't produce
> dropdown list?

Your code replaces one validator with another,
it does not create a list with both.

To have both and get a dropdown you need something like:
db.tecaj.voditelj.requires=[IS_NOT_EMPTY(),IS_IN_DB(...)]

> do i need the IS_NOT_EMPTY() if i have IS_IN_DB validator?

It depends on your data and model.
In your case it is superfluous because you are storing an id which can
not be empty.
But if your requires was: IS_IN_DB(db,'person.name')
and some entry in person.name was empty then you would need an
IS_NOT_EMPTY validator to avoid having an empty entry.

> andrej

Reply via email to