Description
Creates an <input type="checkbox"> element and associated elements to create a toggle switch that controls a checkbox element.
Spawner Widget Name
kind: panel.input.switchbox
JavaScript Method
XNAT.ui.panel.input.switchbox()
Configuration Options
switchboxInput:
kind: panel.input.switchbox
name: fooSwitch
label: Flip The Switch
id: foo-switch
value: ?? XNAT.data.fooValue
checked: true
onText: Yes
offText: No
description: "This describes what this switch turns on or off."
before: "Text or HTML to insert before the input element"
after:
smallTxt:
tag: small.msg
Properties
|
Name |
Value |
Description |
|---|---|---|
|
kind |
panel.form |
Spawner widget type - creates an <input> element with other necessary elements for proper styling and functionality. |
|
name |
(string) |
Name attribute for this input, which must match the property name used for data loading and submission. |
|
label |
(string) |
Label element for input. |
|
id |
(string) |
Value for spawned element's id attribute. |
|
value |
(string, obj, js, url) |
Existing value for input - can be an explicit value as a string, a value looked up from a JavaScript object property, or a REST URL that returns a single value
* "What's with the wacky syntax?" Given this expression:
|
|
onText |
(string) |
Text string to use when switch is in "on" position. |
|
offText |
(string) |
Text string to use when switch is in "off" position. |
|
validation |
(string) |
Space-separated list of validation options |
|
description |
(string-html) |
Brief description of what this element is for and what it does. This can contain HTML so links, images, etc. can be included as well. |
HTML Output