diff --git a/api/js/etemplate/Et2Checkbox/Et2Checkbox.ts b/api/js/etemplate/Et2Checkbox/Et2Checkbox.ts index 0b4c6693c7..a27a3cbe23 100644 --- a/api/js/etemplate/Et2Checkbox/Et2Checkbox.ts +++ b/api/js/etemplate/Et2Checkbox/Et2Checkbox.ts @@ -61,9 +61,9 @@ export class Et2Checkbox extends Et2InputWidget(SlCheckbox) } @property({type: String}) - selectedValue = 'true'; + selectedValue = true; @property({type: String}) - unselectedValue = ''; + unselectedValue = false; constructor() { diff --git a/api/src/Etemplate/Widget/Checkbox.php b/api/src/Etemplate/Widget/Checkbox.php index b65354d8f3..7f28016d76 100644 --- a/api/src/Etemplate/Widget/Checkbox.php +++ b/api/src/Etemplate/Widget/Checkbox.php @@ -68,12 +68,13 @@ class Checkbox extends Etemplate\Widget // defaults for set and unset values $selected_value = true; $unselected_value = false; - if(array_key_exists($value_attr, $this->attrs) || array_key_exists('unselectedValue', $this->attrs) || array_key_exists('unselected_value', $this->attrs)) + if (array_key_exists($value_attr, $this->attrs) || array_key_exists('unselectedValue', $this->attrs) || + array_key_exists('unselected_value', $this->attrs) || array_key_exists('selected_value', $this->attrs)) { - if(array_key_exists($value_attr, $this->attrs)) + if (array_key_exists($value_attr, $this->attrs) || array_key_exists('selected_value', $this->attrs)) { // Expand any content stuff - $selected_value = self::expand_name($this->attrs[$value_attr], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); + $selected_value = self::expand_name($this->attrs[$value_attr] ?? $this->attrs['selected_value'], $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']); } if(array_key_exists('unselectedValue', $this->attrs) || array_key_exists('unselected_value', $this->attrs)) {