Skip to main content

getValue()

returns the current value/state of a checkbox(s)

getValue(id?: string): ICheckboxGroupValue | string | boolean;

Parameters:

id: string - optional, the id of a checkbox

Returns:

Either a string with the current value of the checkbox, or boolean value with the state of the checkbox, or an object with current values/states of the checkboxes.

Example

// returns string value if the value is specified in the checkbox configuration
form.getItem("CheckboxGroup").getValue("checkbox_id_1"); //-> "some_value"

// returns boolean state if the value is not specified for the checkbox
form.getItem("CheckboxGroup").getValue("checkbox_id_2"); //-> true/false

If the id of a checkbox is not specified, the method returns an object. The object contains a set of key:value pairs where key is the id of a checkbox and value is either the value of the checkbox or its state (if the value attribute is not specified for the checkbox).

// returns an object with current values/states of the checkboxes
form.getItem("CheckboxGroup").getValue()
// -> { "checkbox_id_1": "some_value_1", "checkbox_id_2": true }