Values in list:-type fields are stored delimited by "|" characters, so when 
you insert an empty list, "||" is what actually gets inserted in the 
database. Because notnull is enforced by the database, entering an empty 
list does not generate an error because "||" is a string and therefore not 
null. In any case, violation of notnull would result in your application 
returning a 500 server error, not a friendly message printed on the form, 
so the best way to validate the input is by using the "multiple" argument 
to the IS_IN_DB validator, as you have discovered.

Anthony

On Sunday, March 2, 2014 2:49:01 PM UTC-5, André Kablu wrote:
>
> just found the answer
>
> multiple=(1,x)
>
> anyway would be good if the notnull param works
>  
>
>
> Em domingo, 2 de março de 2014 16h34min35s UTC-3, André Kablu escreveu:
>>
>> I am using version 2.9.1 beta
>>
>> When creating a db, if I use this:
>>
>>  Field('product_ids',   'list:reference product')
>>
>> Does not force user to fill the field (not null).
>>
>> Even if I put  notnull=True, the user can bypass the field and left it 
>> blank.
>>
>>
>> Any ideas?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to