---
title: "How to make form elements read-only"
canonical_url: "https://www.nutrient.io/guides/android/knowledge-base/making-form-elements-read-only/"
md_url: "https://www.nutrient.io/guides/android/knowledge-base/making-form-elements-read-only.md"
last_updated: "2026-06-09T10:32:17.001Z"
description: "If you want to make certain form elements in your document read-only, you can set the AnnotationFlags.LOCKEDCONTENTS flag on the associated WidgetAnnotation."
---

If you want to make certain form elements in your document read-only, you can set the [`AnnotationFlags.LOCKEDCONTENTS`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.annotations/-annotation-flags/-l-o-c-k-e-d-c-o-n-t-e-n-t-s/index.html) flag on the associated [`WidgetAnnotation`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.annotations/-widget-annotation/index.html). While the form elements will still be displayed in the document, clicking on them won’t start the form editing view, in turn making them read-only:

```java

List<FormElement> formElements = document.getFormProvider().getFormElements();
for (FormElement formElement : formElements) {
    // This will prevent the user from making changes to this form element.
    formElement.getAnnotation().setFlags(EnumSet.of(AnnotationFlags.LOCKEDCONTENTS));
}

```
---

## Related pages

- [Allow Clear Text Traffic](/guides/android/knowledge-base/allow-clear-text-traffic.md)
- [Compose Qna](/guides/android/knowledge-base/compose-qna.md)
- [Custom Print Functionality](/guides/android/knowledge-base/custom-print-functionality.md)
- [Deleting Pages From A Pdf](/guides/android/knowledge-base/deleting-pages-from-a-pdf.md)
- [Easily disable share and print options in Android](/guides/android/knowledge-base/disable-share-documentinfo-print.md)
- [Disabling Annotation Rotation](/guides/android/knowledge-base/disabling-annotation-rotation.md)
- [Change page layout dynamically based on orientation](/guides/android/knowledge-base/dynamic-page-layout-when-changing-orientation.md)
- [Managing touch scrolling in Compose containers](/guides/android/knowledge-base/document-view-inside-pager-scroll-handling.md)
- [Getting Signature Location](/guides/android/knowledge-base/getting-signature-location.md)
- [Install Failed Insufficient Storage](/guides/android/knowledge-base/install-failed-insufficient-storage.md)
- [Intercepting Touch Events](/guides/android/knowledge-base/intercepting-touch-events.md)
- [Getting All Digital Signatures](/guides/android/knowledge-base/getting-all-digital-signatures.md)
- [Invoke Search Programmatically](/guides/android/knowledge-base/invoke-search-programmatically.md)
- [Creating invisible digital signatures in Android](/guides/android/knowledge-base/invisible-signature.md)
- [Invoking Share Action Programmatically](/guides/android/knowledge-base/invoking-share-action-programmatically.md)
- [Override Hyperlink Behavior](/guides/android/knowledge-base/override-hyperlink-behavior.md)
- [Remove Tool Variant From Toolbar](/guides/android/knowledge-base/remove-tool-variant-from-toolbar.md)
- [Runtime Permissions Cordova](/guides/android/knowledge-base/runtime-permissions-cordova.md)
- [Save signed PDFs directly to a remote server on Android](/guides/android/knowledge-base/save-signed-pdfs-to-remote-server.md)
- [Customize the overflow button color in Android](/guides/android/knowledge-base/styling-overflow-button.md)
- [Using Pspdfkit With Dynamic Feature Modules](/guides/android/knowledge-base/using-pspdfkit-with-dynamic-feature-modules.md)

