The radio field.

Properties

TitleRadio Group Field
DescriptionRadio Group Field with list of options.
Field Typeradio
Base Field TypeNone

Schema

PropertyTypeDefaultDescription
defaultanyThe default value to be assigned for this property. If the data for the field is empty or not provided, this default value will be plugged in for you. Specify a default value when you want to pre-populate the field's value ahead of time.
dependenciesarrayList of property dependencies.
descriptionstringDetailed description of the property.
disallowarrayList of disallowed values for the property.
enumarrayList of field value options
formatstringData format of the property.
readonlybooleanIndicates that the field is read-only. A read-only field cannot have it's value changed. Read-only fields render in a grayed-out or disabled control. If the field is rendered using a view with the displayReadonly attribute set to false, the read-only field will not appear.
requiredbooleanIndicates whether the field's value is required. If set to true, the field must take on a valid value and cannnot be left empty or unassigned.
titlestringShort description of the property.
typestringData type of the property.

Options

PropertyTypeDefaultDescription
dataSourcestringDatasource for generating list of options. This can be a string or a function. If a string, it is considered S be a URI to a service that produces a object containing key/value pairs or an array of elements of structure {'text': '', 'value': ''}. This can also be a function that is called to produce the same list.
disabledbooleanField will be disabled if true.
emptySelectFirstbooleanIf the data is empty, then automatically select the first item in the list.
fieldClassstringSpecifies one or more CSS classes that should be applied to the dom element for this field once it is rendered. Supports a single value, comma-delimited values, space-delimited values or values passed in as an array.
focuscheckboxtrueIf true, the initial focus for the form will be set to the first child element (usually the first field in the form). If a field name or path is provided, then the specified child field will receive focus. For example, you might set focus to 'name' (selecting the 'name' field) or you might set it to 'client/name' which picks the 'name' field on the 'client' object.
formobjectOptions for rendering the FORM tag.
helperstringField help message.
helpersarrayAn array of field help messages. Each message will be displayed on it's own line.
helpersPositionstringbelowDefines the placement location of the helper text relative to the control (either 'above' or 'below')
hiddenbooleanField will be hidden if true.
hideInitValidationErrorbooleanHide initial validation errors if true.
hideNonebooleanWhether to hide the None option from a list (select, radio or otherwise). This will be true if the field is required and false otherwise.
idstringUnique field id. Auto-generated if not provided.
joinfunctionFor multiple select lists. Defines a f(a) for how selected options should be combined into a single string. A split function should also be defined which reverses this function.
labelstringField label.
namestringField name.
noneLabelstringNoneThe label to use for the 'None' option in a list (select, radio or otherwise).
optionLabelsarrayAn array of string labels for items in the enum array
readonlybooleanField will be readonly if true.
removeDefaultNonebooleanIf true, the default 'None' option will not be shown.
showMessagesbooleantrueDisplay validation messages if true.
sortfunctionDefines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well as results that come back from any data sources (for select and radio controls). By default the items are sorted alphabetically. Don't apply any sorting if false.
splitfunctionFor multiple select lists. Defines a f(a) for how data strings should be split into individual values. A join function should also be defined which reverses this function.
typestringradioField type.
useDataSourceAsEnumbooleantrueWhether to constrain the field's schema enum property to the values that come back from the data source.
validatebooleantrueField validation is required if true.
verticalbooleantrueBy default, radio controls are stacked vertically. Set to false if you'd like radio controls to lay out horizontally.
viewstringAllows for this field to be rendered with a different view (such as 'display' or 'create')

Example 1

Radio button field with data, options and schema parameters. As default, radio group field will be rendered if schema enum properties has 3 or less options.

Example 2

Required radio button field with option labels.

Example 3

Radio button field with more than 3 options and custom option labels.

Example 4

Radio button in display-only mode.

Example 5

A radio field that uses the removeDefaultNone option to remove the option for the end user to select None from the list of available options. In addition, the vertical option is set to false`` specified to inform the field to render horizontally. If not specified,vertical``` is assumed to be true.

Note that if the property that the field describes is required for data integrity to be maintained, consider setting the property schema's required setting to true. This produces the same effect and also allows your data to validate appropriately.

Example 6

A radio field with disabled values.

Example 7

An example of a radio button field mounted on top of an array of strings. Note a radio group only allows for a single selection and so the maximum size of the array will be 1.

Example 8

An example of a radio button field that loads its values from a data source.

Example 9

Example that sets value after render.

© 2019 Gitana Software, Inc.

Alpaca is sponsored by