Skip to main content
Version: 5.0.0

Checkbox and radio

The checkbox and radio criteria answer a yes/no or pick one of a few visible options: radio and button-radio choose one, checkbox is a yes/no (drawn as a switch with the switch style) and button-checkbox chooses several. Below are the real criteria of the AWE React client: pick a type, change its attributes and the XML below follows. The selects and suggests criteria have their own page.

Live preview
XML
<criteria id="demo"
component="radio"
label="Field"
group="plan"
value="basic"
checked="true"
style="no-label" />
<criteria id="demo2"
component="radio"
label="Business"
group="plan"
value="business"
style="no-label" />
<criteria id="demo3"
component="radio"
label="Enterprise"
group="plan"
value="enterprise"
style="no-label" />

The controls above write these attributes. The reference lists every attribute, its type and default. Attributes in the XSD reference

AttributeControlValues
componentComponentradiobutton-radiocheckboxbutton-checkbox
labelLabeltext
sizeSizesmlg
styleShow as a switchtrue / false
validationRequiredtrue / false
readonlyRead onlytrue / false

The attributes shared by every criterion (label, size, validation) are in the criteria overview. Radios that share a group are one choice: choosing one clears the others. The options of a button-radio and a button-checkbox come from an enumerated list (initial-load and target-action say which one); here the server is simulated with a static list.

Recipes​

Common fields, rendered by the same components.

Radio group​

Radios with the same group are one choice. Each one carries its own value, and checked marks the one chosen at the start.

<criteria id="plan1" component="radio" label="Basic" group="plan" value="basic" checked="true" style="no-label" />
<criteria id="plan2" component="radio" label="Business" group="plan" value="business" style="no-label" />
<criteria id="plan3" component="radio" label="Enterprise" group="plan" value="enterprise" style="no-label" />

Required checkbox​

A checkbox with validation="required" must be checked before the form is sent. Use it for an acceptance, such as the terms of a service.

<criteria id="terms" component="checkbox" label="I accept the terms" validation="required" />

Switch​

A checkbox with the switch style is drawn as a switch. Its label is the text beside it.

<criteria id="notify" component="checkbox" label="Email me when it ships" style="switch" />

Events and actions​

A criterion has no event of its own to listen to: every change of its value checks the dependencies whose dependency-element names it, and pressing Enter in a text field runs the submit button of its window. The actions that work on criteria:

ActionDescription
resetEmpties the value of the criterion
restorePuts back the initial value of the criterion
validateRuns the validation of the criterion and shows its error
set-invalidMarks the criterion as invalid with the message of the action
set-validClears the validation error of the criterion
copy-criterion-value-clipboardCopies the value of the criterion to the clipboard

More​