---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, widgets, tags, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: radioGroup
layout: subsection
wd_wcptag: radioGroup
---

<a id="section_N10021_N1001E_N10001"></a>
Creates a list of radio buttons in which users can only select 1 at a time. If you don’t use the required attribute on this tag, the option “None of the above” displays with the list.

Use `radioGroup` on edit pages when you want to enable users to select a single option from a list.

## <a id="section_ywn_vpj_2gb"></a>Example

This snippet demonstrates a `radioGroup` whose default value depends on the `checkBox`. The `onChange` event handler of the `checkBox` sets the value of the `radioGroup`.

```
{
 "type" : "checkBox",
 "label" : "Have expense items?",
 "id": "expenseCheckBox",
 "value" : "<% expenseEntries.total > 0 ? true : false %>",
 "onChange": "<% self.value ? reviewRadioGroup.setValue([ 'yes' ]) : reviewRadioGroup.setValue([ 'no' ])  %>"
},
{
 "type": "radioGroup",
 "id": "reviewRadioGroup",
 "label": "Need review?",
 "hideDisplayOption": "true",
 "selectedValues":
   "<% ! empty expenseCheckBox.value ? (expenseCheckBox.value ? ['yes'] : ['no'] ) : ['no']  %>",
 "instanceList": [
   {
     "id": "yes",
     "descriptor": "Yes"
   },
   {
     "id": "no",
     "descriptor": "No"
   }
 ]
}
```

The sample `expenseEntries` endpoint:

```
{
  "name": "expenseEntries",
  "authType": "sso",
  "url": "<% '/entries?fromDate=2021-03-15' %>",
  "baseUrlType": "workday-expenses"
}
```

## <a id="section-mobile-support"></a>Mobile Support

Android, iOS

## <a id="section_attributes"></a>Attributes

-   <b>cacheValues</b>

    Data type: boolean

    Indicates whether or not to cache values for sharing among users.

-   <b>displayKey</b>

    Data type: string

    The name of the field containing the display value on the list. The default is `descriptor`, which assumes that the data collection contains a field named `descriptor`.

    Typically used with the `idKey` attribute to override the default `id` field on the list.

    Supports JSONPath notation.

    If your data collection doesn't contain the `descriptor` field, use `displayKey` to override the default. Specify a root-level field. If you want to use a nested field, use JSONPath notation.

-   <b>enabled</b>

    Data type: dynamicBinding-Boolean

    If true, users can enter values on the widget. If false, users can only view the widget.

-   <b>helpText</b>

    Data type: binding-String

    Text that displays when a user hovers their cursor over the widget.

    <b>Note:</b> The Chrome browser truncates the tooltip to 1400 characters.

-   <b>id</b>

    Data type: binding-String

    Unique identifier used to reference this widget from other tags.

    Notes:

    -   The `id` must start with a letter.
    -   The `id` must be unique per page.
    -   To enable other widgets to reference this widget `id`, place this widget before the other widgets on the PMD. The PMD validation returns an "Undefined variable" error if it doesn't find a previously defined `id` in the PMD.
    -   Workday recommends that you include the `id` in your tag definitions for debugging purposes.

-   <b>idKey</b>

    Data type: string

    The name of the ID field, which is the index field on the list. The default is `id`, which assumes that the data collection contains a field named `id`.

    Typically used with the `displayKey` attribute to override the default `descriptor` field on the list.

    Supports JSONPath notation.

    If your data collection doesn't contain the `id` field, use `idKey` to override the default. Specify a root-level field. If you want to use a nested field, use JSONPath notation.

-   <b>instanceList</b>

    Data type: list of instance objects

    An array of `id` and `descriptor` values in the list.

    Example:

    ```
    "instanceList": [
    {
      "id": "1",
      "descriptor": "Yes"
    },
    {
      "id": "2",
      "descriptor": "No"
    }
    ]
    ```

    <b>Notes:</b>

    -   You can't combine `instanceList` with the `instanceListLoopTag` or `values` attributes to populate a list. These attributes are mutually exclusive.
    -   To enable the related actions menu and view link, set the `wid` attribute. Specify the binding to the ID field containing the instance Workday ID. For details, see Enabling the Related Actions Menu in [instanceList](/wcp_docs/hcb1512514976081.html).

-   <b>instanceListLoopTag</b>

    Data type: instanceLoop

    <b>Note:</b> Workday recommends using PMD scripting with the `values` attribute to reshape data instead of the `instanceListLoopTag` attribute.

    Creates list values by using a template instance while iterating through a data collection. The `instanceListLoopTag` attribute is an [instanceLoop](/wcp_docs/fem1530169946255.html) tag that specifies the:

    -   `templateInstance` - Contains the template `id` and `descriptor` fields for a list item. You can specify root-level or nested fields.
    -   `on` - The binding to the data collection.
    -   `as` - The variable reference for each instance.
    -   `limit` - Optional maximum number of list items.

    Example:

    ```
    "instanceListLoopTag": {
    "type": "instanceLoop",
    "id": "sampleInstanceListLoopTag",
    "templateInstance": {
      "id": "<% workerInstance.primarySupervisoryOrganization.id %>",
      "descriptor": "<% workerInstance.primarySupervisoryOrganization.descriptor %>"
    },
    "on": "<% workers.data %>",
    "as": "workerInstance",
    "limit": 5
    }
    ```

    <b>Note:</b> You can't combine `instanceListLoopTag` with the `instanceList` or `values` attributes to populate a list. These attributes are mutually exclusive.

-   <b>label</b>

    Data type: dynamicBinding-String

    Text that displays beside or above most widgets. Often used in simple widgets that include inputs.

    The maximum number of characters is 255.

-   <b>hideDisplayOption</b>

    Data type: binding-Boolean

    If true, we hide the default <b>None of the Above</b> option. By default, the radioGroup tag generates the <b>None of the Above</b> option for non-required radio button lists.

-   <b>render</b>

    Data type: binding-Boolean

    If true, this tag renders as a widget on the page. If false, the loaded page doesn't add this tag or its children. The default is true.

    Unlike the `visible` attribute, when `render` is false, other tags on the page can't reference this tag or widget on edit pages. On view pages, a tag can't reference other tags regardless of the `render` attribute value.

-   <b>required</b>

    Data type: dynamicBinding-Boolean

    If true, the user must enter a value on the widget before submitting the page.

-   <b>selectedValues</b>

    Data type: dynamicBinding-List

    The first ID in the list specifies the selected item on the widget. The specified ID must be included in the list of values.

-   <b>valueOutBinding</b>

    Data type: dynamicBinding-String

    A binding to the JSON field that stores the widget value in the outbound request payload.

    Example:

    ```
    {
    "type":"textArea",
    "id":"memo",
    "label":"Memo",
    "value":"<% queryParams.memo %>",
    "valueOutBinding": "expensesPostEndpoint.memo"
    }
    ```

    When the user submits the edit page, we send the request payload containing field values as specified in `valueOutBinding`.

    This sample JSON request payload contains the memo field sent to the sample `expensesPostEndpoint`:

    ```
    {"memo": "Sample value from the memo widget."}
    ```

    If you want to send an array of JSON values to the outbound endpoint, specify the path using this pattern: `anEndpointName.[].aJsonFieldName`.

    Example: To send this array to the sample outbound endpoint:

    ```
    [{"memo":"First memo"}, {"memo":"Second memo"}]
    ```

    Specify this `valueOutBinding`:

    ```
    "valueOutBinding" : "expensesPostEndpoint.[].memo"
    ```

    <b>Note:</b> If the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the widget's `valueOutBinding` data in the outbound payload. To include the `valueOutBinding` data in the payload, use the `onSend` event handler.

-   <b>values</b>

    Data type: dynamicBinding-List

    Defines all possible values that a user can select from a list. Each value defaults to an id and descriptor for persistence and display. You can customize these values on the <i>idKey</i> and <i>displayKey</i> attributes.

    <b>Note:</b> You can't combine `values` with the `instanceList` or `instanceListLoopTag` attributes to populate a list. These attributes are mutually exclusive.

-   <b>valuesOut</b>

    Data type: list of outValue objects

    An array of values and their bindings to JSON fields in the outbound request payload.

    An array item consists of these attributes:

    -   `value` - An object binding of the value to include in the outbound JSON.
    -   `valueOutBinding` - A string binding of the JSON field that contains the value in the request payload. We send the request payload with the outbound endpoint when the user submits the page.

    You can use `valuesOut[]` to:

    -   Send a single piece of data to multiple outbound fields or endpoints. Example: A street address persisting to a Billing Address field and a Shipping Address field or different endpoints.
    -   Apply a function to the outbound value when persisting the data. Example: Convert a date to a specific format or convert a list to a string.

    In this example, the value of the `country` widget is sent to 2 different outbound fields `shippingAddress.country` and `billingAddress.country`.

    ```
    "valuesOut": [
    {
      "value": "<% country.value[0] %>",
      "valueOutBinding": "anOutboundEndpoint.shippingAddress.country.id"
    },
    {
      "value": "<% country.value[0] %>",
      "valueOutBinding": "anOutboundEndpoint.billingAddress.country.id"
    }
    ]
    ```

    This example uses PMD functions to extract the year and month from date values, and sends them separately to the outbound endpoint:

    ```
    "valuesOut": [
    {
      "value": "<% date:month(date1.value) %>",
      "valueOutBinding": "anOutboundEndpoint.dateMonth"
    },
    {
      "value": "<% string:toString(date:year(panelList1Date1.value)) %>",
      "valueOutBinding": "anOutboundEndpoint.dateYear"
    }
    ]
    ```

    <b>Note:</b> If the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the widget's `valuesOut` data in the outbound payload. To include the `valuesOut` data in the payload, use the `onSend` event handler.

-   <b>visible</b>

    Data type: dynamicBinding-Boolean

    If true, the widget generated by this tag is visible. If false, this tag and its children tags aren't visible. This tag provides the ability to display or hide the widget dynamically based on user interactions on the page. The default is true. Unlike the `render` attribute, the generated widget persists on the page even when `visible` is false.

    <b>Notes:</b>

    -   When the widget or field you’re hiding changes on the page, you must include it inside a `fieldSet`.
    -   When the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the `valueOutBinding` or `valuesOut` data of the widget in the payload. To include the `valueOutBinding` or `valuesOut` data in the payload, use the `onSend` event handler.



## <a id="section_pmdScriptingMethods"></a>PMD Scripting Methods

-   <b>clearError()</b>

    Return type: `void`

    Description: Clears the validation error.

-   <b>clearWarning()</b>

    Return type: `void`

    Description: Clears the validation warning.

-   <b>getLabel()</b>

    Return type: `string`

    Description: Returns the list label.

-   <b>getPromptSelections(int index)</b>

    Return type: `List`

    Returns a list containing the `id` of the selected values of a multilevel `instanceList`. Example: `promptSelections[0]` contains the `id` of the selected value at the root level. `promptSelections[1]` contains the `id` of the selected value at the second level, and so on.

    <b>Note:</b> The `getPromptSelections(index)` method (or its equivalent `promptSelections` property) applies only to a multilevel `instanceList` that contains `monikerLevels`. You can use promptSelections as a URL path parameter of a deferred endpoint that returns the sublevel values. See "Defining a Multilevel List" in [instanceList](/wcp_docs/hcb1512514976081.html).

-   <b>getSelectedEntries()</b>

    Return type: `List`

    Description: Returns a list of maps containing the `id` and `descriptor` fields for the selected entries on the instance list.

    Example: `[{"id": "123", "descriptor": "Logan McNeil"}]`

    If the list doesn't have a selected value, the `getSelectedEntries` method (or its equivalent `selectedEntries` property) returns an empty list, `[]`. When you get the `descriptor` value of the selected entry, always check whether or not the list value is empty. Example:

    ```
    <% !empty someList.value ? someList.selectedEntries[0].descriptor : null %>
    ```

-   <b>getValue()</b>

    Return type: `List`

    Description: Returns this instance list as a list of instance ids. Example: `["123", "456"]`

    If the list is empty, the `getValue` method (or its equivalent `value` property) returns an empty list, `[]`.

-   <b>getValueOutBinding()</b>

    Return type: `string`

    Description: Returns the outbound value binding of this instance list.

-   <b>isEnabled()</b>

    Return type: `boolean`

    Description: If true, this widget is enabled.

-   <b>isRequired()</b>

    Return type: `boolean`

    Description: If true, this widget is required.

-   <b>isUpdated()</b>

    Return type: `boolean`

    Description: If true, this widget is manually updated by the end-user.

-   <b>isUpdatedByScript()</b>

    Return type: `boolean`

    Description: If true, this widget is programmatically updated by a PMD script.

-   <b>isVisible()</b>

    Return type: `boolean`

    Description: If true, this widget is visible.

-   <b>setEnabled(boolean enabled)</b>

    Return type: `void`

    Description: Enables or disables this widget.

-   <b>setError(String error)</b>

    Return type: `void`

    Description: Sets the validation error. The input error message displays in the page error window.

-   <b>setLabel(String label)</b>

    Return type: `void`

    Description: Sets the list label.

-   <b>setRequired(boolean required)</b>

    Return type: `void`

    Description: Makes this widget required or not required.

-   <b>setValue(List value)</b>

    Return type: `void`

    Description: Sets this instance list to the specified list of instance `id` values. You can use `someList.setValue(['id1', 'id2'])` to set the `selectedValues` property of an `instanceList`.

-   <b>setValueOutBinding(String valueOutBinding)</b>

    Return type: `void`

    Description: Sets the outbound value binding to this instance list.

-   <b>setValues(List dataSource)</b>

    Return type: `void`

    Description: Sets all possible values of this instance list. The dataSource list must include the `id` and `descriptor` fields (or the fields specified by the `idKey` and `displayKey` attributes).

-   <b>setVisible(boolean visible)</b>

    Return type: `void`

    Description: Displays or hides this widget.

    If you need to change the visibility of a list widget, ensure that it's inside a `fieldSet`.

-   <b>setWarning(String warning)</b>

    Return type: `void`

    Description: Sets the validation warning.



## <a id="section_pmdScriptingEvents"></a>PMD Scripting Events

-   <b>onChange</b>

    Triggers when the user changes the value of the widget.



