mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
allow to set (string) "true" as selectedValue for a checkbox, while default is (boolean) true and false for unselectedValue
also fix validation in case an old eTemplate with attribute (un)selected_value is used
This commit is contained in:
parent
75063e500a
commit
d7391b4dc6
@ -61,9 +61,9 @@ export class Et2Checkbox extends Et2InputWidget(SlCheckbox)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property({type: String})
|
@property({type: String})
|
||||||
selectedValue = 'true';
|
selectedValue = true;
|
||||||
@property({type: String})
|
@property({type: String})
|
||||||
unselectedValue = '';
|
unselectedValue = false;
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
|
@ -68,12 +68,13 @@ class Checkbox extends Etemplate\Widget
|
|||||||
// defaults for set and unset values
|
// defaults for set and unset values
|
||||||
$selected_value = true;
|
$selected_value = true;
|
||||||
$unselected_value = false;
|
$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
|
// 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))
|
if(array_key_exists('unselectedValue', $this->attrs) || array_key_exists('unselected_value', $this->attrs))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user