
Bug: checkboxes not always initial checked
Reported by dleffler | January 16th, 2015 @ 06:11 PM | in 2.3.3 (closed)
This is a regression bug as a result of trying to correct another issue with building checkboxes...most controls have a value which is established when created ('default' parameter), but a checkbox also has a 'checked' parameter...the intent is that a checkbox can pass a 'value' in addition to being 'checked'...not sure if we use this returned value in exp rather than set/unset.
This problem mostly appears when we build checkboxes programmatically in php rather than in the template since our smarty 'control' function accounts for both the value/default AND the checked params.
Comments and changes to this ticket
-
dleffler January 17th, 2015 @ 08:43 PM
The issue lies in how we treat a particular form control property: $default - which in most cases is the current setting...which for some controls can also be the 'value' html input parameter since it is not only the 'value' used to initialize the control, but is also the value returned.
For form controls which may have multiple items (dropdowns, radios, and yes checkboxes), the 'value' is actually the returned value IF that form control was active/selected/checked.
Therefore, the (simple) fix will be to treat 'default' as 'checked' for checkboxes and have the control class property 'value' defaulted to '1' since this is the value we use to instantiate the control in most cases (the 'value' param is passed as '1'). For the 'control' smarty function, we want to handle 'checked' as $default and 'value' as $value...we don't accept a 'default' smarty param.
-
expNinja January 18th, 2015 @ 08:51 PM
- State changed from new to resolved
(from [dad8110eb9c8d743cde850e9c5ad59f21ae4b096]) Regression fix checkbox initial state; default=checked...value=value [#1258 state:resolved] https://github.com/exponentcms/exponent-cms/commit/dad8110eb9c8d743...
-
expNinja January 19th, 2015 @ 12:07 PM
(from [8c0f5de66d0095fefee7ec5465e0ef7717621bb9]) Regression fix latest checkbox regression fix where all checkboxes would be checked [#1258] https://github.com/exponentcms/exponent-cms/commit/8c0f5de66d0095fe...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Bug Tracker for Exponent CMS