---
title: "Handle unsupported PDF form actions | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/knowledge-base/handle-unsupported-form-field-actions/"
md_url: "https://www.nutrient.io/guides/web/knowledge-base/handle-unsupported-form-field-actions.md"
last_updated: "2026-05-18T15:55:46.126Z"
description: "Learn how to fix errors when modifying form fields with unsupported JavaScript actions such as onBlur in Nutrient Web SDK."
---

# Fix errors with unsupported form field actions

When modifying PDF form fields in Nutrient Web SDK, you may encounter errors if the fields contain unsupported JavaScript actions. This guide explains how to identify and resolve such errors.

## The problem

Attempting to modify form fields that contain unsupported JavaScript actions, such as `onBlur`, can result in the following errors:

```

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'script')

```

```

Uncaught (in promise) PSPDFKitError: Assertion failed: JavaScriptAction requires script

```

## Understanding action support

Form field objects and widget annotations support different sets of actions:

- **Form field objects** — Support a limited set of actions. For the complete list, refer to the [FormFieldAdditionalActions](https://www.nutrient.io/api/web/classes/NutrientViewer.FormFields.FormField.html#additionalactions) API reference.

- **Widget annotations** — Support a wider range of actions, including `onBlur`. For the complete list, refer to the [WidgetAnnotationAdditionalActions](https://www.nutrient.io/api/web/classes/NutrientViewer.Annotations.WidgetAnnotation.html#additionalactions) API reference.

## Solution

To modify form fields with unsupported actions, first remove these actions, and then apply your desired changes:

```js

NutrientViewer.load({...baseOptions,
  theme: NutrientViewer.Theme.DARK,
}).then(async (instance) => {
  const formFields = await instance.getFormFields();

  // Identify form fields with `onBlur` actions and remove only those actions.
  const fieldsWithOnBlur = formFields.filter((formField) => {
      return formField?.additionalActions?.onBlur;
    }).map((formField) =>
      formField.set(
        "additionalActions",
        formField.additionalActions.delete("onBlur"),
      ),
    );

  try {
    // Remove the `onBlur` actions.
    await instance.update(fieldsWithOnBlur);

    // Apply your desired changes (for example, setting fields to read-only).
    await instance.update(
      (await instance.getFormFields()).map((formField) =>
        formField.set("readOnly", true),
      ),
    );
  } catch (error) {
    console.log(error);
  }
});

```

[Try this in the Playground](https://www.nutrient.io/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llbGRzKCkpLm1hcCgoZm9ybUZpZWxkKSA9PlxuICAgICAgICBmb3JtRmllbGQuc2V0KFwicmVhZE9ubHlcIiwgdHJ1ZSlcbiAgICAgIClcbiAgICApO1xuICB9IGNhdGNoIChlcnJvcikge1xuICAgIGNvbnNvbGUubG9nKGVycm9yKTtcbiAgfVxufSk7In0=).

This approach:

1. Identifies form fields with `onBlur` actions.

2. Surgically removes only the `onBlur` action while preserving other supported actions.

3. Applies the desired changes to the form fields.

4. Uses a `try`/`catch` block to handle any remaining errors.

## Important considerations

- Form field objects don’t support the `onBlur` action, but widget annotations do.

- For PDFs with many form fields or complex embedded JavaScript, some errors may still occur when rendering new pages. If this happens, contact our [Support team](https://support.nutrient.io/hc/en-us/requests/new) with the specific error messages and a sample PDF if possible.

- The `try`/`catch` block ensures your code continues to run even if some errors occur.

For more information about JavaScript actions support in Nutrient Web SDK, refer to the [PDF actions support](https://www.nutrient.io/guides/web/forms/pdf-actions-support.md#javascriptaction) guide.
---

## Related pages

- [Add Custom Keyboard Shortcuts](/guides/web/knowledge-base/add-custom-keyboard-shortcuts.md)
- [Add Signature Initials](/guides/web/knowledge-base/add-signature-initials.md)
- [Add Listener Text Note Annotation](/guides/web/knowledge-base/add-listener-text-note-annotation.md)
- [How to add a custom toolbar item to display current zoom percentage](/guides/web/knowledge-base/add-custom-zoom-perentage.md)
- [Add Listener Toolbar Item](/guides/web/knowledge-base/add-listener-toolbar-item.md)
- [Listen to an annotation’s hover event](/guides/web/knowledge-base/annotations-hover-event.md)
- [Blurry Print Resolution](/guides/web/knowledge-base/blurry-print-resolution.md)
- [Automatic Annotation Field Tab Ordering](/guides/web/knowledge-base/automatic-annotation-field-tab-ordering.md)
- [Check Document Contains Annotations](/guides/web/knowledge-base/check-document-contains-annotations.md)
- [Change Default Line Width Ink Annotations](/guides/web/knowledge-base/change-default-line-width-ink-annotations.md)
- [Keep widget annotation dimensions consistent across devices](/guides/web/knowledge-base/consistent-widget-annotation-dimensions.md)
- [Control Appearance Of Delete Button On Ink Annotations](/guides/web/knowledge-base/control-appearance-of-delete-button-on-ink-annotations.md)
- [Check Password Protected Files](/guides/web/knowledge-base/check-password-protected-files.md)
- [Create Highlight Annotations From Text Extraction Technology](/guides/web/knowledge-base/create-highlight-annotations-from-text-extraction-technology.md)
- [Customize Page Indicator](/guides/web/knowledge-base/customize-page-indicator.md)
- [Delete All Annotations](/guides/web/knowledge-base/delete-all-annotations.md)
- [Default To Cloudy Border](/guides/web/knowledge-base/default-to-cloudy-border.md)
- [Export Ink Annotation Image](/guides/web/knowledge-base/export-ink-annotation-image.md)
- [Detect Pspdfkit Ui Loaded](/guides/web/knowledge-base/detect-pspdfkit-ui-loaded.md)
- [Disable Resize Of Annotations](/guides/web/knowledge-base/disable-resize-of-annotations.md)
- [Download Exported Document](/guides/web/knowledge-base/download-exported-document.md)
- [Deselect Text](/guides/web/knowledge-base/deselect-text.md)
- [How to disable text annotation movement in web apps](/guides/web/knowledge-base/disable-text-annotation-movement.md)
- [Determine Current Layout Mode](/guides/web/knowledge-base/determine-current-layout-mode.md)
- [Disable Context Menu](/guides/web/knowledge-base/disable-context-menu.md)
- [Extracting text and cursor position in annotations](/guides/web/knowledge-base/extract-annotation-text-and-retrieve-cursor-position.md)
- [Find Ink Annotation For Signature Form Field](/guides/web/knowledge-base/find-ink-annotation-for-signature-form-field.md)
- [Focus Viewer After Loading](/guides/web/knowledge-base/focus-viewer-after-loading.md)
- [Focus the delete button in a confirm dialog](/guides/web/knowledge-base/focus-delete-button-in-confirm-modal-component.md)
- [Get Entered Document Password](/guides/web/knowledge-base/get-entered-document-password.md)
- [Focus Widget Annotation](/guides/web/knowledge-base/focus-widget-annotation.md)
- [Highlight required form fields](/guides/web/knowledge-base/highlight-required-fields.md)
- [Handling Clicks On Custom Overlays](/guides/web/knowledge-base/handling-clicks-on-custom-overlays.md)
- [How Do I Disable Scrolling On Page Edges](/guides/web/knowledge-base/how-do-i-disable-scrolling-on-page-edges.md)
- [Get Visible Annotations](/guides/web/knowledge-base/get-visible-annotations.md)
- [Resize multiline text fields to avoid overflow](/guides/web/knowledge-base/how-do-i-resize-form-fields.md)
- [How Do I Prevent Printing Annotations](/guides/web/knowledge-base/how-do-i-prevent-printing-annotations.md)
- [How Do I Limit The Number Of Annotations](/guides/web/knowledge-base/how-do-i-limit-the-number-of-annotations.md)
- [How To Create Bookmarks From Outline Elements](/guides/web/knowledge-base/how-to-create-bookmarks-from-outline-elements.md)
- [License Registered Different Bundle Id](/guides/web/knowledge-base/license-registered-different-bundle-id.md)
- [How Do I Toggle The Theme](/guides/web/knowledge-base/how-do-i-toggle-the-theme.md)
- [Image Attachments Lost Stamp Annotation Templates](/guides/web/knowledge-base/image-attachments-lost-stamp-annotation-templates.md)
- [Load Pdf As Arraybuffer](/guides/web/knowledge-base/load-pdf-as-arraybuffer.md)
- [How Do I Zoom To A Specific Value](/guides/web/knowledge-base/how-do-i-zoom-to-a-specific-value.md)
- [Load Pdf From Stream](/guides/web/knowledge-base/load-pdf-from-stream.md)
- [Iterate over form fields and widgets](/guides/web/knowledge-base/iterate-over-form-fields.md)
- [Link Text](/guides/web/knowledge-base/link-text.md)
- [How Do I Rotate A Page](/guides/web/knowledge-base/how-do-i-rotate-a-page.md)
- [Loading Multiple Files](/guides/web/knowledge-base/loading-multiple-files.md)
- [Observe Document Editor Visibility](/guides/web/knowledge-base/observe-document-editor-visibility.md)
- [Load Pdf Stub From String](/guides/web/knowledge-base/load-pdf-stub-from-string.md)
- [Nutrient Size Optimization](/guides/web/knowledge-base/nutrient-size-optimization.md)
- [Disabling automatic synchronization in Nutrient Web SDK](/guides/web/knowledge-base/manual-instant-sync.md)
- [Override User Agent](/guides/web/knowledge-base/override-user-agent.md)
- [Override Ink Signature Dialog](/guides/web/knowledge-base/override-ink-signature-dialog.md)
- [Persist Currently Edited Note Test](/guides/web/knowledge-base/persist-currently-edited-note-test.md)
- [Overview](/guides/web/knowledge-base/overview.md)
- [Programmatic Comment Annotations](/guides/web/knowledge-base/programmatic-comment-annotations.md)
- [Process Currently Rendered Pages](/guides/web/knowledge-base/process-currently-rendered-pages.md)
- [Persist Ink Signatures Across Instances](/guides/web/knowledge-base/persist-ink-signatures-across-instances.md)
- [Place Annotation At Visible Center](/guides/web/knowledge-base/place-annotation-at-visible-center.md)
- [Prevent Editing Content Text Annotation](/guides/web/knowledge-base/prevent-editing-content-text-annotation.md)
- [Prevent Shortcut Printing](/guides/web/knowledge-base/prevent-shortcut-printing.md)
- [Read-only forms](/guides/web/knowledge-base/read-only-forms.md)
- [Render Page Without Annotations](/guides/web/knowledge-base/render-page-without-annotations.md)
- [Programmatically Navigate To Page](/guides/web/knowledge-base/programmatically-navigate-to-page.md)
- [Render Page Black White](/guides/web/knowledge-base/render-page-black-white.md)
- [Render Visible Area In Current Page](/guides/web/knowledge-base/render-visible-area-in-current-page.md)
- [Render Watermark When Printing](/guides/web/knowledge-base/render-watermark-when-printing.md)
- [Render Document Full Height](/guides/web/knowledge-base/render-document-full-height.md)
- [Restore Last Seen Page](/guides/web/knowledge-base/restore-last-seen-page.md)
- [Rotate Ink Annotation](/guides/web/knowledge-base/rotate-ink-annotation.md)
- [Render Night Mode](/guides/web/knowledge-base/render-night-mode.md)
- [Show Focus Ring Read Only](/guides/web/knowledge-base/show-focus-ring-read-only.md)
- [Save Modified Pdf To Document Engine](/guides/web/knowledge-base/save-modified-pdf-to-document-engine.md)
- [Show Annotations Properties As Tooltip](/guides/web/knowledge-base/show-annotations-properties-as-tooltip.md)
- [Submit Ink Signatures With Form](/guides/web/knowledge-base/submit-ink-signatures-with-form.md)
- [Easily zoom to specific annotations in PDF](/guides/web/knowledge-base/zoom-to-specific-annotation.md)
- [Web Sdk Vs Dws Viewer](/guides/web/knowledge-base/web-sdk-vs-dws-viewer.md)
- [Wait For Element Appear](/guides/web/knowledge-base/wait-for-element-appear.md)

