On Friday, 30 March 2012 17:42:45 UTC+1, Fran wrote:
>
> On Friday, 30 March 2012 17:01:43 UTC+1, Anthony wrote:
>>
>> I see it did default to 0, but the form doesn't get saved...just as I
>>>> originally said...
>>>>
>>> The error comes from the e in (v, e) = self.other(item)
>>> i.e. "value not allowed" from the IS_IN_SET()
>>> I tried adding "" to the set, but obviously that's not an integer so it
>>> gets rejected...
>>>
>> Is the problem that one or more of the input fields generated by the
>> widget is being submitted with no value, and therefore the IS_IN_SET
>> validator is returning an error?
>>
> Exactly
>
Do you not want an error in that case?
>
Right
>
I thought that I might eb able to get away with just changing IS_LIST_OF to:
if self.minimum and self.other:
(i.e. don't bother checking the other if minimum=0 since this will be an
IS_NULL_OR()
However this gives the same basic error:
File "C:\Bin\web2py\gluon\sqlhtml.py", line 1290, in accepts
self.vars.id = self.table.insert(**fields)
File "C:\Bin\web2py\gluon\dal.py", line 7030, in insert
ret = self._db._adapter.insert(self,self._listify(fields))
File "C:\Bin\web2py\gluon\dal.py", line 968, in insert
query = self._insert(table,fields)
File "C:\Bin\web2py\gluon\dal.py", line 964, in _insert
values = ','.join(self.expand(v,f.type) for f,v in fields)
File "C:\Bin\web2py\gluon\dal.py", line 964, in <genexpr>
values = ','.join(self.expand(v,f.type) for f,v in fields)
File "C:\Bin\web2py\gluon\dal.py", line 1100, in expand
return str(self.represent(expression,field_type))
File "C:\Bin\web2py\gluon\dal.py", line 1456, in represent
obj = [int(item) for item in obj]
ValueError: invalid literal for int() with base 10: ''
Can list:integer fields not be NULL?
F