Commit c50ff749 authored by Julien Muchembled's avatar Julien Muchembled

Fix hidden checkboxes. HTML tag can be

<input type="hidden" name="field_your_foo" value="0"  />
which was interpreted as non-null due to missing ':int' suffix.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24984 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5f9bab1
......@@ -255,13 +255,12 @@ MultiSelectionValidator.validate = MultiSelectionValidator_validate
from Products.Formulator.Validator import BooleanValidator
def BooleanValidator_validate(self, field, key, REQUEST):
result = REQUEST.get(key, REQUEST.get('default_%s' % (key, )))
if result is None:
raise KeyError, 'Field %s is not present in request object.' % (repr(field.id), )
if (not not result)==True:
return 1
else:
return 0
result = REQUEST.get(key, REQUEST.get('default_%s' % key))
if result is None:
raise KeyError('Field %r is not present in request object.' % field.id)
# XXX If the checkbox is hidden, Widget_render_hidden is used instead of
# CheckBoxWidget_render, and ':int' suffix is missing.
return result and result != '0' and 1 or 0
BooleanValidator.validate = BooleanValidator_validate
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment