« Back to Product

Documentation

RadioButtonGroup

Require: Symcon >= 9.1

Creates a group of radio buttons with the heading caption.
If created in the "elements" area, the radio buttons set a property to the selected value value when accepted.
The parameter "name" defines which property is set.

Warning

With MultiSelect it is important to ensure that all value arrays contain the same names

Warning

If RadioButtonGroup is used within lists, there is no MultiSelect.

Example

Parameter

Parameter Description
caption Visible caption of the group of radio buttons
download (optional) (default: "") If this parameter is not an empty string and the output of the onChange script is a Data-URL, the output is downloaded as a text file with the name of the download parameter.
enabled (optional) (default: true) If true, the group can be used, otherwise it is displayed as deactivated
link (optional) (default: false) If this parameter is true, the output of the onChange script is opened as a link. If it is false, the output is displayed as a dialog in the configuration form.
name (optional) Name of the group/the property to be set
options Array containing all options
onChange (optional) (default: "") Script which is executed when a radio button is selected. If the script consists of several lines, the individual lines can also be defined as an array. It has the same properties as onClick of the Button
type RadioButtonGroup
value (optional) (default: first defined option) The value of the selected radio button - If there is an associated property, this parameter is overwritten by the property in the elements area
visible (optional) (default: true) If true, the group is visible, otherwise it is invisible
width (optional) (default: 300px) Fixed width of the group in pixels or % as a string, e.g. "40%" or "250px"

Parameters for options

Parameter Description
caption Caption of a radio button
enabled (optional) (default: true) If true, the radio button is active and can be selected, otherwise it is shown as inactive and cannot be selected
value Value that is transferred when selected. Can also contain another array, which transfers the values to several properties.

Example

//Simple value transfer
//The "DeviceType" property is set to 0..3
//The group has 4 radio buttons
{ "type": "RadioButtonGroup", "name": "DeviceType", "caption": "Unit",
    "options": [
        { "caption": "Bit (1Bit)", "value": 0 },
        { "caption": "Bits (2Bit)", "value": 1 },
        { "caption": "Bits (4Bit)", "value": 2 },
        { "caption": "Byte (8Bit)", "value": 3 }
    ]
}

//Multiple value transfer (MultiSelect)
//"name" of the RadioButtonGroup (here: "OutputDevice") must be set, but is not used to set the values.
//Properties "DeviceName", "DeviceChannels" and "DeviceNum" are set.
{ "type": "RadioButtonGroup", "name": "OutputDevice", "caption": "Output device",
    "options": [
        {"caption" : "No sound",
            "value": [
                {"name": "DeviceName", "value": "No sound"},
                {"name": "DeviceChannels", "value": 0},
                {"name": "DeviceNum", "value": 0}
            ]
        },
        {"caption" : "Headphones",
            "value": [
                {"name": "DeviceName", "value": "Headphones"},
                {"name": "DeviceChannels", "value": 2},
                {"name": "DeviceNum", "value": 1}
            ]
        },
        {"caption" : "Speaker",
            "value": [
                {"name": "DeviceName", "value": "Stereo speakers"},
                {"name": "DeviceChannels", "value": 2},
                {"name": "DeviceNum", "value": 2}
            ]
        }
    ]
}
Any questions?