---
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: richText
layout: subsection
wd_wcptag: richText
---

<a id="section_N10021_N1001E_N10001"></a>
Enables you to use HTML tags to define rich text formatting values on view or edit pages.

The data type of the `richText` widget value is String. The maximum size is 5 MB.

The `richText` widget preserves space indentations in the text.

## <a id="section_hsd_gdb_z2b"></a>Examples

Centered heading:

```
{
    "type": "richText",
    "label": "Centered heading:",
    "id": "richTextId1",
    "value": "<h2 style=\"text-align: center;\">Job Profile</h2>"
}
```

```
<h2 style=\"text-align: center;\"><% jobProfile.title %></h2>
```

Formatted paragraph:

```
{
    "type": "richText",
    "label": "Right-aligned paragraph:",
    "id": "richTextId2",
    "value": "<p style=\"text-align:right\">Sidebar <span style=\"font-size:20px; color:green;\">semi-important <b>news</b> <br/>and updates</span></p>"
}
```

## <a id="section_formattingValues"></a>Formatting Values

<table><thead><tr><th>HTML Tag</th><th>Allowed Attributes</th><th>Allowed Style Attributes</th></tr></thead><tbody><tr><td>h1</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>h2</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>h3</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>a</td><td>href</td><td> </td></tr><tr><td>b</td><td> </td><td> </td></tr><tr><td>i</td><td> </td><td> </td></tr><tr><td>u</td><td> </td><td> </td></tr><tr><td>ul</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>li</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>p</td><td>style</td><td>margin-left: (pixels) <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>span</td><td><p>style</p> <p>id</p> <p>class</p></td><td>font-size: (pixels) <p>color</p> <p>margin-left: (pixels)</p> <p>margin-right: (pixels)</p> <p>text-align: left|center|right</p></td></tr><tr><td>br</td><td> </td><td> </td></tr></tbody></table><br/>

## <a id="section_mobileSupport"></a>Mobile Support

Android, iOS

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

-   <b>aiPrompt</b>

    Data type: `aiPrompt` object

    For Extend Professional customers: see [aiPrompt in richText](/wcp_docs/GUID-2267ac13-43f2-4dbf-9d25-9808158d2725-enHYPHENus.html).

-   <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>formatAsDate</b>

    Data type: binding-Boolean

    If true, the text format of a date value reflects the current date format. Default is false.

    If you use the `date:format` function to display a date value with a specific date format (example: `"value" : "<% date:format(dateField.value, 'dd/MM/yyyy') %>"`, set `formatAsDate` to false.

-   <b>guide</b>

    Data type: `guide`

    Displays a <b>?</b> widget that opens a popup window containing guidance information about a widget on an edit page. For details, see the `guide` tag.

-   <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>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>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>sortOrder</b>

    Data type: binding-String

    When you set `sorted` to true on the `section` or `fieldSet` parent of this widget, the `sortOrder` attribute determines the order of this widget within its parent. The sort order is relative to the siblings of the widget.

    Typical values are "a", "b", "c", and so on. Example: The widget with `"sortOrder": "a"` displays before the widget with `"sortOrder": "b"`.

    <b>Note:</b> The `sortOrder` doesn't apply to sorting data on the widget. `sortOrder` only applies to the placement order of the widgets within the parent widget.

-   <b>saveAsBusinessObjectRichText</b>

    Data type: boolean

    If true, we save the `richText` data as a RICH_TEXT type field on a business object in which embedded hyperlinks go through a cleanup process that removes its attributes except for the "href" and "target" attributes.

    If false (default), there is no extra processing for embedded hyperlinks in the rich text data.

    The `saveAsBusinessObjectRichText` attribute only applies to edit pages.

-   <a id="dlentry_value_richText"></a><b>value</b>

    Data type: dynamicBinding-String

    The display value in a rich text field. The value can include HTML markup for rich text formatting. Users can change this value on edit pages.

-   <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>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_pmdScriptingEvents"></a>PMD Scripting Events

-   <b>onChange</b>

    Triggers periodically while the user types the text.



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

-   <a id="d36e373"></a><b>clearError()</b>

    Return type: `void`

    Description: Clears the validation error.

-   <a id="d36e388"></a><b>clearWarning()</b>

    Return type: `void`

    Description: Clears the validation warning.

-   <b>getLabel()</b>

    Return type: `string`

    Description: Returns the widget label.

-   <a id="d36e418"></a><b>getValue()</b>

    Return type: `Object`

    Description: Returns the value of this widget.

-   <a id="d36e433"></a><b>getValueOutBinding()</b>

    Return type: `string`

    Description: Returns the outbound value binding of this widget.

-   <b>isEnabled()</b>

    Return type: `boolean`

    Description: Returns true if this widget is enabled.

-   <b>isRequired()</b>

    Return type: `boolean`

    Description: Returns true if 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: Returns true if this widget is visible.

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

    Return type: `void`

    Description: Enables or disables this widget.

-   <a id="d36e540"></a><b>setError(String error)</b>

    Return type: `void`

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

-   <a id="d36e555"></a><b>setLabel(String label)</b>

    Return type: `void`

    Description: Sets the widget label.

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

    Return type: `void`

    Description: Makes this widget required or not required.

-   <a id="d36e585"></a><b>setValue(Object value)</b>

    Return type: `void`

    Description: Sets the value of this widget.

    For `date` widgets: When you set the value of a `date` widget to an empty value, specify `null` instead of an empty string. Example: `dateWidgetId.setValue(null)` or `dateWidgetId.value = null`.

-   <a id="d36e618"></a><b>setValueOutBinding(String valueOutBinding)</b>

    Return type: `void`

    Description: Sets the outbound value binding to this widget.

-   <a id="d36e633"></a><b>setVisible(boolean visible)</b>

    Return type: `void`

    Description: Displays or hides this widget.

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

-   <a id="d36e655"></a><b>setWarning(String warning)</b>

    Return type: `void`

    Description: Sets the validation warning.



### Related Information

[Tutorial: Format Text on View and Edit Pages](https://wd5.myworkday.com/workday/learning/course/f18ca7875d521005123a3c6295230000?type=9882927d138b100019b928e75843018d)

