Closed tareqalam closed 4 years ago
Mohammad Tareq Alam wrote at 2019-12-1 05:18 -0800:
I found this issue today when I had some hidden checkbox fields in default page. How to reproduce: in schema have a checkbox field make the display mode hidden widgets[f].mode = HIDDEN_MODE then load the form and just save the form while the field is hidden. then change the mode to INPUT_MODE and load the form you will see all option of the checkbox field is checked. Here is code for hidden mode checkbox I see: https://github.com/zopefoundation/z3c.form/blob/master/src/z3c/form/browser/checkbox_hidden.pt To solve this I think this input field need a condition tal:condition="item/checked" to load the hidden input field with value ONLY if an item is checked marked. Please contact me if any question about how to reproduce. skype: tareqalam
A "hidden" control should behave on save in the same way as a "normal" control. The only difference is that a "hidden" control is not shown to the user and the "saved" value does not come from user interaction but from the original value.
I assume that you want to report a different problem: even if the original value of the "hidden" checkbox is "unchecked", it is saved as "checked". Am I correct?
Yes you are right. Original value unchecked but saved as checked. Sorry for misunderstanding.
On Sun, Dec 1, 2019, 4:51 PM Dieter Maurer notifications@github.com wrote:
Mohammad Tareq Alam wrote at 2019-12-1 05:18 -0800:
I found this issue today when I had some hidden checkbox fields in default page. How to reproduce: in schema have a checkbox field make the display mode hidden widgets[f].mode = HIDDEN_MODE then load the form and just save the form while the field is hidden. then change the mode to INPUT_MODE and load the form you will see all option of the checkbox field is checked. Here is code for hidden mode checkbox I see: https://github.com/zopefoundation/z3c.form/blob/master/src/z3c/form/browser/checkbox_hidden.pt To solve this I think this input field need a condition tal:condition="item/checked" to load the hidden input field with value ONLY if an item is checked marked. Please contact me if any question about how to reproduce. skype: tareqalam
A "hidden" control should behave on save in the same way as a "normal" control. The only difference is that a "hidden" control is not shown to the user and the "saved" value does not come from user interaction but from the original value.
I assume that you want to report a different problem: even if the original value of the "hidden" checkbox is "unchecked", it is saved as "checked". Am I correct?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zopefoundation/z3c.form/issues/89?email_source=notifications&email_token=AAHEGL5ARZLDAVWFSF6NQODQWPMPLA5CNFSM4JTLUO6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRM6OQ#issuecomment-560123706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHEGL7TLK3XK6XVYRGCWALQWPMPLANCNFSM4JTLUO6A .
I am not convinced that the checkbox widget implementation does not contain more problems as the available tests use a surprising type as widget.value
(str
instead of a sequence of str
) and a default term 'selected'
for SingleCheckboxWidget
which may or may not be used as widget value representation for the boolean True
. Can you check that a boolean field behaves correctly?
I checked the boolean field (SingleCheckboxWidget
) also behaves correctly now. thanks.
I found this issue today when I had some hidden checkbox fields in default page. How to reproduce: in schema have a checkbox field make the display mode hidden widgets[f].mode = HIDDEN_MODE then load the form and just save the form while the field is hidden. then change the mode to INPUT_MODE and load the form you will see all option of the checkbox field is checked. Here is code for hidden mode checkbox I see: https://github.com/zopefoundation/z3c.form/blob/master/src/z3c/form/browser/checkbox_hidden.pt To solve this I think this input field need a condition tal:condition="item/checked" to load the hidden input field with value ONLY if an item is checked marked. Please contact me if any question about how to reproduce. skype: tareqalam