this is pretty basic for web2py models ....

Every Field() "requires" attribute can be a single or a list of validators.
If you need to check against multiple validator, append them, as 
db.table.field = [validator1, validator2]
There is one caveat: when there is more than one validator no select widget 
would be build for IS_IN_DB or IS_IN_SET (no way to tell what other 
validation will occur)

Il giorno lunedì 2 luglio 2012 10:59:08 UTC+2, Annet ha scritto:
>
> In a table definition I have the following validators:
>
> db.PromoUnit.promoPositionID.requires=IS_IN_DB(db,'PromoPosition.id','%(name)s',orderby='PromoPosition.id',zero='select
>  
> a value')
> db.PromoUnit.sequenceNumber.requires=IS_IN_SET(['1','2','3'],zero='select 
> a value')
> db.PromoUnit.sequenceNumber.requires=IS_NOT_IN_DB(db(db.PromoUnit.sequenceNumber==request.vars.sequenceNumber),db.PromoUnit.promoPositionID,error_message='combination
>  
> promo position sequence number already in database')
>
>
> The IS_NOT_IN_DB validator removes the IS_IN_SET drop box of 
> sequenceNumber, is there a way to prevent this from happening?
>
>  
> Annet
>

Reply via email to