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 ...@@ -255,13 +255,12 @@ MultiSelectionValidator.validate = MultiSelectionValidator_validate
from Products.Formulator.Validator import BooleanValidator from Products.Formulator.Validator import BooleanValidator
def BooleanValidator_validate(self, field, key, REQUEST): def BooleanValidator_validate(self, field, key, REQUEST):
result = REQUEST.get(key, REQUEST.get('default_%s' % (key, ))) result = REQUEST.get(key, REQUEST.get('default_%s' % key))
if result is None: if result is None:
raise KeyError, 'Field %s is not present in request object.' % (repr(field.id), ) raise KeyError('Field %r is not present in request object.' % field.id)
if (not not result)==True: # XXX If the checkbox is hidden, Widget_render_hidden is used instead of
return 1 # CheckBoxWidget_render, and ':int' suffix is missing.
else: return result and result != '0' and 1 or 0
return 0
BooleanValidator.validate = BooleanValidator_validate 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