Message1820
Properties of type *BooleanHTMLProperty* do loose the
*No* selection if a form is submitted for the second
type (e.g. like forms that have a pre-filter submit).
This is caused by the *field* method for that class. In
the method there is a test on self._value at line 1280
(0.7.11). Thus any value other than None, '' or False
in *_value* will give the a True result.
The radio buttons have as value 'yes' and 'no'. So on a
submit either 'yes' or 'no' is submitted. When the
submit results in a backend update, _value will get
either True or False from the backend. But if the
submit did not update the backend, _value will be
either 'yes' or 'no'. Both these values will result in
True in the test at line 1280 causing the 'Yes' radio
button to be checked even if the previous selection was
'No'.
The next patch will solve this problem:
Index: cgi/templating.py
===================================================================
@@ -1276,8 +1276,7 @@
if not self.is_edit_ok():
return self.plain()
- checked = self._value and "checked" or ""
- if self._value:
+ if self._value and self._value != 'no':
s = self.input(type="radio",
name=self._formname, value="yes",
checked="checked")
s += 'Yes'
Also doesn't have line 1279 any meaning. The *checked*
variable isn't used anywhere and could be removed.
Best regards,
Marlon |
|
Date |
User |
Action |
Args |
2009-02-03 14:21:09 | admin | link | issue1101492 messages |
2009-02-03 14:21:09 | admin | create | |
|