---
title: "Workday Extend PMD Grid Cell Errors & pageActionButton"
description: "Clear individual grid cell errors on onChange, validate all rows via grid.getRows(), and block page save when a pageActionButton deferred check fails."
url: https://kiweely.com/guides/workday-extend-pmd-clear-grid-cell-error-pageactionbutton-block-save
---

# Clearing Grid Cell Validation Errors on onChange and Blocking Page Save on pageActionButton Failure in Workday Extend PMD

Learn how to clear cell-level validation errors in Workday Extend PMD grids when a user updates a cell, avoid the getSelectedRows() border-highlighting trap during onSubmit, and block page submission when a pageActionButton deferred WQL lookup fails.

-   **Checked** against Workday on November 6
-   Applies to **Workday Extend**
-   3 min read
-   Published November 6
-   By Kiweely

## Clearing a Specific Grid Cell Error Immediately on `onChange`

When a user edits an invalid cell inside a Workday Extend PMD `grid`, the validation error on that cell—and the page’s overall error banner count—should decrement immediately without clearing errors on other rows or cells.

Every basic UI widget (`text`, `number`, `date`, `currency`, `checkBox`, `textArea`) and list widget (`instanceList`, `dropdown`, `radioGroup`) used inside a grid column’s `cellTemplate` supports the instance methods `setError(String error)` and `clearError()`. When you attach an `onChange` event handler to a widget inside `cellTemplate`, referencing the cell widget’s `id` (or `self`) scopes the call to the current row’s cell instance:

json

```
{
  "type": "grid",
  "id": "timeOffData",
  "label": "Time Off Entries",
  "doNotAdd": true,
  "doNotRemove": true,
  "selectionEnabled": true,
  "enabled": true,
  "rows": "<% getHistoryData.data ?? [] %>",
  "rowVariableName": "thisRow",
  "columns": [
    {
      "type": "column",
      "columnId": "colCategory",
      "label": "Leave Category",
      "sortableAndFilterable": true,
      "cellTemplate": {
        "type": "text",
        "id": "categoryField",
        "value": "<% thisRow.category ?? '' %>",
        "onChange": "<%
          if (!empty self.value && empty reasonField.value) {
            reasonField.setError('Reason is required when Leave Category is populated.');
          }
        %>"
      }
    },
    {
      "type": "column",
      "columnId": "colReason",
      "label": "Reason",
      "sortableAndFilterable": true,
      "cellTemplate": {
        "type": "text",
        "id": "reasonField",
        "value": "<% thisRow.reason ?? '' %>",
        "onChange": "<%
          if (!empty reasonField.value) {
            reasonField.clearError();
          } else {
            reasonField.setError('Reason is a mandatory field.');
          }
        %>"
      }
    }
  ]
}
```

When the user types a valid value into `reasonField` on row 2 and tabs out of the cell, `reasonField.clearError()` removes the red error border from that specific cell and reduces the page error counter by one while leaving any validation errors on row 1 or row 3 intact.

## Why `onSubmit` Fails to Highlight All Invalid Cells When Using `getSelectedRows()`

A frequent bug occurs when developers validate grid cells inside the page’s `onSubmit` event handler and notice that the page error banner shows the total error count, but the red error border only appears on the currently selected row (or does not highlight unselected rows).

This happens when the `onSubmit` script iterates over `grid.getSelectedRows()` instead of `grid.getRows()`. In PMD scripting:

-   `grid.getSelectedRows()` returns only the subset of grid row objects whose selection checkbox is currently checked.
-   `grid.getRows()` (or `grid.getChildren()`) returns **all** grid row objects rendered in the grid.

To validate every row on page submit and apply the red error border to every offending cell across the entire grid, iterate over `grid.getRows()` and access each cell widget via `row.get('<columnId>')` (when `cellTemplate` contains a single widget) or `row.get('<columnId>').get('<childWidgetId>')` (when `cellTemplate` wraps widgets inside a `section` or `fieldSet`):

javascript

```
"onSubmit": "<%
  var allRows = timeOffData.getRows();
  for (var row : allRows) {
    var categoryCell = row.get('colCategory');
    var reasonCell = row.get('colReason');
    if (!empty categoryCell.value && empty reasonCell.value) {
      reasonCell.setError('Reason is a mandatory field.');
    } else {
      reasonCell.clearError();
    }
  }
%>"
```

## Blocking Page Save When a `pageActionButton` Deferred Validation Fails

On PMD edit pages, developers often use a `pageActionButton` (such as a **Validate** or **Verify Routing Number** button) to invoke a deferred WQL or REST endpoint (`"deferred": true`) and populate read-only fields before the user submits the page.

When the deferred WQL query returns no matching record, you must display a custom error message and prevent the user from clicking **OK** to save the page. However, `pageActionButton` is an action trigger, not a data input widget—it **does not support `self.setError()`**. Attempting to call `self.setError(...)` inside a `pageActionButton`‘s `onClick` script fails.

### Setting the Validation Error on a Target or Hidden Widget

In Workday Extend, any active widget error set via `.setError('...')` on a basic or list widget on the page automatically blocks page submission until `.clearError()` is called on that widget. Instead of calling `setError()` on the `pageActionButton`, call `setError()` on the target input/display widget (such as `bankName`) or on a dedicated `hidden` validation widget.

First, define the deferred WQL endpoint in `endPoints`:

json

```
{
  "name": "getBankDetails",
  "baseUrlType": "wql",
  "authType": "sso",
  "deferred": true,
  "url": "<% '/data?query=' + string:urlEncode('SELECT bankName FROM customBankDirectory WHERE routingNumber = \\'' + routingNumberInput.value + '\\'') %>"
}
```

Next, define the target `text` widget (and optionally a `hidden` widget if you want a page-level error that is not visually anchored to a single input box) alongside the `pageActionButton`:

json

```
{
  "type": "text",
  "id": "routingNumberInput",
  "label": "Routing Number",
  "required": true
},
{
  "type": "text",
  "id": "bankName",
  "label": "Bank Name",
  "enabled": false,
  "value": ""
},
{
  "type": "pageActionButton",
  "id": "validateBankBtn",
  "label": "Validate Bank",
  "onClick": "<%
    var response = getBankDetails.invoke();
    if (empty(response.data)) {
      bankName.setValue('');
      bankName.setError(
        'Please check the required fields again, as with the current provided values there is no matching bank name.'
      );
      pageVariables.bankValidated = false;
    } else {
      bankName.clearError();
      bankName.setValue(response.data[0].bankName);
      pageVariables.bankValidated = true;
    }
  %>"
}
```

To also prevent the user from clicking **OK** without ever clicking **Validate Bank** first, add an `onSubmit` check on the page that verifies `pageVariables.bankValidated == true` (or `!empty(bankName.value)`) and calls `bankName.setError(...)` if validation has not been run:

javascript

```
"onSubmit": "<%
  if (empty(bankName.value)) {
    bankName.setError('Click Validate Bank to verify a matching bank before saving.');
  }
%>"
```

## How to Verify in the Tenant

1.  Open the edit page in your Workday Extend tenant and click **OK** with invalid cells across multiple unselected grid rows. Confirm that every invalid row displays a red cell border and appears in the page error popup.
2.  Edit one invalid cell in the grid and tab out. Verify that the error border on that specific cell clears immediately and the error banner count decreases by one.
3.  Enter an invalid routing number and click **Validate Bank**. Confirm that the custom error message appears in the error banner and clicking **OK** is blocked until a valid routing number is validated and `bankName.clearError()` executes.

## Sources checked

-   [Reference: PMD Scripting Widget Methods](https://developer.workday.com/documentation/hno1582318947208)
-   [pageActionButton PMD Tag Reference](https://developer.workday.com/documentation/jje1617899729875)
-   [Reference: PMD Scripting Events](https://developer.workday.com/documentation/tgy1581495452394)
-   [grid PMD Tag Reference](https://developer.workday.com/documentation/zmz1518211268000)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Fixing radioGroup Options Disappearing When selectedValues Is Empty and Disabling Specific Options in Workday Extend PMD In Workday Extend PMD, setting enabled to false on a radioGroup when selectedValues is null or \[\] hides every option. Learn how to keep unselected radio options visible, bind 3+ option radio groups on edit pages, and filter radioGroup or multi-select instanceList choices with setValues().](https://kiweely.com/guides/workday-extend-pmd-radiogroup-options-disappear-disable-specific-items)
-   [### Deleting Selected Grid Rows and Fixing Parallel Multi-Instance Arrays Collapsing on Edit Pages in Workday Extend PMD Workday Extend PMD does not permit outbound DELETE calls inside onRowSelect, and storing grid columns as separate multi-instance fields on a single BO record causes edit grids to collapse into one row. Learn how to handle row deletion on submit and zip parallel arrays by index.](https://kiweely.com/guides/workday-extend-pmd-grid-delete-selected-rows-parallel-arrays-collapse)
-   [### Displaying dynamicColumns in a Workday Extend PMD Grid and Flattening Nested Arrays into Rows Workday Extend developers often confuse variable child rows with runtime-generated grid columns. This guide covers flattening nested RaaS or REST arrays into grid rows, configuring dynamicColumns with cellTemplates, and rendering arbitrary WQL SELECT fields using map:getKeys().](https://kiweely.com/guides/workday-extend-pmd-dynamic-grid-columns-flattening-arrays)

### More guides on Extend apps and pages

[All 97 guides](https://kiweely.com/guides#extend)

-   [Resolving “Tenant mapping not found (OP-4008)”, EU vs. US Regional Base URL 401 Errors, and client\_secret\_basic in Workday Extend OAuth 2.0](https://kiweely.com/guides/workday-extend-oauth-tenant-mapping-op-4008-eu-base-url-client-secret-basic)
-   [Working Around the 10-Relationship Limit on a Workday Extend Model Business Object (MCBO) Using a Helper Object](https://kiweely.com/guides/workday-extend-mcbo-10-single-instance-relationship-limit-helper-bo)
-   [How to Blank Out Text Fields and Nullify Reference Values on Workday Extend Business Objects via Inbound EIB Using {empty}](https://kiweely.com/guides/workday-extend-eib-clear-text-nullify-fields-empty-tag)
-   [Fixing “Object instance has properties which are not allowed by the schema (parentBusinessProcesses, initiationPageRoute)” on Extend Subprocesses](https://kiweely.com/guides/workday-extend-bp-subprocess-allowedparentprocesses-eventstepid)
-   [Cascading dropdowns and instance lists in Workday Extend](https://kiweely.com/guides/workday-extend-cascading-instance-lists)
-   [How to move Workday Extend apps to a new developer tenant before the old one expires or is deleted](https://kiweely.com/guides/workday-extend-move-apps-new-developer-tenant)
-   [Why a Workday Graph API query suddenly fails with “Cannot query field”](https://kiweely.com/guides/workday-graphql-cannot-query-field)
-   [How to build a worker search prompt in a Workday Extend page](https://kiweely.com/guides/workday-extend-worker-search)

### From the blog on Extend apps and pages

[All posts](https://kiweely.com/blog)

-   [Five Workday Extend app blueprints you can build in a free personal tenant](https://kiweely.com/blog/five-workday-extend-apps-to-build-in-open-developer-program)
-   [From Business Brief to Tested Workday Extend App: Why Zero Validation Errors Is Not Proof](https://kiweely.com/blog/why-workday-extend-validation-is-not-testing)
-   [Workday Extend Graph API and AppHub Promotion: Moving Apps From Development to Sandbox](https://kiweely.com/blog/workday-extend-graph-api-and-apphub-promotion)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
