---
title: "Detect user clicks in PDF form elements on Android | Nutrient"
canonical_url: "https://www.nutrient.io/guides/android/forms/fill-form-fields/detect-clicks/"
md_url: "https://www.nutrient.io/guides/android/forms/fill-form-fields/detect-clicks.md"
last_updated: "2026-06-09T10:32:42.684Z"
description: "With Nutrient, it’s possible to detect when a form element is clicked or selected for editing."
---

# Detecting user clicks in PDF form elements on Android

With Nutrient, it’s possible to detect when a form element is clicked or selected for editing.

## Reacting to clicks on form elements

The default on-click behavior of form elements depends on their type:

- Taps on push buttons lead to an [execution of the `Action`](https://www.nutrient.io/guides/android/annotations/pdf-actions/), which is set on the form element.

- Taps on signature fields [start the signing flow](https://www.nutrient.io/guides/android/features/digital-signatures.md).

- Taps on other fields lead to form element selection and entering the form editing mode.

Default tap behavior can be fully customized by registering [`OnFormElementClickedListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.manager/-form-manager/-on-form-element-clicked-listener/index.html) via [`addOnFormElementClickedListener()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/add-on-form-element-clicked-listener.html) on [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html):

### KOTLIN

```kotlin

fragment.addOnFormElementClickedListener { formElement ->
    when {
        formElement.type == FormType.SIGNATURE -> {
            // Implement custom signature flow here....

            // By returning `true`, you intercept the event and prevent PSPDFKit from showing the signature picker itself.
            true
        }
        formElement.type == FormType.PUSHBUTTON -> {
            // Implement custom push button click handling....

            // By returning `true`, you intercept the event and prevent PSPDFKit from executing the button's action.
            true
        }
        else -> {
            // This click event isn't interesting for us. Return `false` to let PSPDFKit handle this click event.
            false
        }
    }
}

```

### JAVA

```java

fragment.addOnFormElementClickedListener(formElement -> {
    if (formElement.getType() == FormType.SIGNATURE) {
        // Implement custom signature flow here....

        // By returning `true`, you intercept the event and prevent PSPDFKit from showing the signature picker itself.
        return true;
    } else if (formElement.getType() == FormType.PUSHBUTTON) {
        // Implement custom push button click handling....

        // By returning `true`, you intercept the event and prevent PSPDFKit from executing the button's action.
        return true;
    }

    // This click event isn't interesting for us. Return `false` to let PSPDFKit handle this click event.
    return false;
});

```

## Reacting to form element selection

Most form elements, with the exception of buttons and signature fields, can be selected for interactive editing. You can get notified about this via [`OnFormElementSelectedListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.manager/-form-manager/-on-form-element-selected-listener/index.html) and [`OnFormElementDeselectedListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.manager/-form-manager/-on-form-element-deselected-listener/index.html), both of which can be registered on [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html).

Form selection also leads to entering the form element editing mode. You can react to its lifecycle by registering [`OnFormElementEditingModeListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.manager/-form-manager/-on-form-element-editing-mode-change-listener/index.html) on [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html). If you want to learn more, refer to the [custom form editing UI](https://www.nutrient.io/guides/android/customizing-the-interface/using-form-ui-within-fragment.md) guide that describes how to use this listener to integrate Nutrient’s form filling UI when using custom activities built around [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html).
---

## Related pages

- [Attach files to PDF form fields on Android](/guides/android/forms/fill-form-fields/attach-a-file.md)
- [Fill PDF form fields programmatically on Android](/guides/android/forms/form-filling.md)
- [Undo and redo for PDF forms on Android](/guides/android/forms/fill-form-fields/undo-and-redo.md)
- [Form field support in our Android PDF viewer](/guides/android/forms/fill-form-fields/using-the-ui.md)
- [Detect user input in Android PDF forms](/guides/android/forms/fill-form-fields/detect-user-input.md)

