Commit 6c2a50b
committed
Fix element saving broken by unchecked-checkbox submission change
The previous commit stopped submitting empty values for unchecked
checkboxes. This broke element saving in ViewMapAddModify: the toggle_<attr>
checkboxes control whether an attribute overrides its inherited value, and
the PHP code used has_var('toggle_' . $attr) to detect whether a toggle was
rendered in the form at all (vs. the attribute being a must-field with no
toggle). With unchecked toggles no longer submitted, has_var returned false
for unchecked toggles too, causing all toggled-off attributes to be treated
as "no toggle = include unconditionally", which selected all elements.
Fix by rendering a hidden sentinel field (_has_toggle_<attr>) alongside each
toggle checkbox. has_var now checks the sentinel, which is always submitted
as a hidden field regardless of the checkbox state, so the distinction
between "toggle present but unchecked" and "no toggle rendered" is preserved.1 parent a381a55 commit 6c2a50b
2 files changed
Lines changed: 8 additions & 1 deletion
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
465 | 471 | | |
466 | 472 | | |
467 | 473 | | |
| |||
0 commit comments