getValue()
returns the current value/state of a toggle(s)
getValue(id?: string): string | boolean | number | {[id: string]: boolean | string | number};
Parameters:
id: string
- optional, the id of a toggle
Returns:
If the id of a toggle is specified, the method returns either a string|number with the current value of the toggle, or a boolean value with the state of the toggle.
If the id of a toggle is not specified, the method returns an object with the current values/states of toggles. The object contains a set of key:value pairs where the key is the id of a toggle and the value is either the value of a toggle or its state (if the value attribute is not specified for the toggle).
Example
// returns a string value if the value is specified in the toggle configuration
form.getItem("ToggleGroup").getValue("toggle_1"); //-> "some_value"
// returns a boolean state if the value is not specified for the toggle
form.getItem("ToggleGroup").getValue("toggle_2"); //-> true/false
// returns an object with the current values/states of toggles
form.getItem("ToggleGroup").getValue();
// -> { "toggle_1": "some_value_1", "toggle_2": true }