> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/forms/create-fields.md).

# Create and edit form fields

Learn how to create and edit form fields in Android using UI components or programmatically with the Apryse Android SDK. Explore supported widget types and disable form field creation with ToolManager

There are two options to create and edit form fields. First is using a UI component that can create and edit form fields. Second is an API guide to programmatically create form fields.

{% tabs %}
{% tab title="UI component" %}

## Create & edit form fields in Android

Interactive creation and editing for form fields such as text fields, checkboxes, radio buttons, dropdowns, signatures, etc. is supported by the Apryse Android SDK.

By default, creating and editing form fields in the drop-in components [DocumentActivity](/android/open-save-document/open/activity.md) and [PdfViewCtrlTabHostFragment2](/android/open-save-document/open/fragment.md) are automatically enabled unless disabled using [`ToolManagerBuilder`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/config/ToolManagerBuilder.html). You can learn more about configuring ToolManager [here](/android/annotation/toolmanager-config.md).

## Supported widget types

### Text widget

`TextFieldCreate` tool is responsible for making `TextWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-fca326c6d99a0e2658bf115e34d6e39570dfcf25%2Facba37ab612320b5b7adedeacf7fdc51ba1a6590-600x1200.gif?alt=media)

### Checkbox widget

`CheckboxFieldCreate` tool is responsible for making `CheckBoxWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-da690a220b0dbf3f811cfd9641b0a20d64f7b70f%2Fb5e0cfcfbd2234932998772c2190d2e367bebbd8-600x1200.gif?alt=media)

### Radio button widget

`RadioGroupFieldCreate` tool is responsible for making `RadioButtonWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-030329e98475af72b29eb78a29f038133d2c9002%2F6f81278445fc447307d80020dbb55b3ef83db940-600x1200.gif?alt=media)

### List box widget

`ListBoxFieldCreate` tool is responsible for making `ListBoxWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-ad92cf4580fb4d0915d26d3b4f990c8802900f83%2Ff922b1c1a7ba3ea4580a69ec5ef0df728d6b817b-600x1200.gif?alt=media)

### Combo box widget

`ComboBoxFieldCreate` tool is responsible for making `ComboBoxWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-8b697b34555240704356f98ba9f6e9f2c77d27cc%2Fe285f18411b5f767c0819c03d09d70ae4024402b-600x1200.gif?alt=media)

### Signature widget

`SignatureFieldCreate` tool is responsible for making `SignatureWidget`.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-962d75e6865737b3eb25452035c2ec9e40eaabb7%2Fe23cd7791d5ed84f1eb1286b3e71ae78d06af0b3-600x1200.gif?alt=media)

## Disable form field creation

You can disable form field creation using the `ToolManagerBuilder` class and disabling the relevant [`ToolMode`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/tools/ToolManager.ToolMode.html):

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
// Create a custom ToolManager with disabled form field creation
ToolManager.ToolMode[] toolModes = {
    ToolManager.ToolMode.FORM_CHECKBOX_CREATE,
    ToolManager.ToolMode.FORM_SIGNATURE_CREATE,
    ToolManager.ToolMode.FORM_TEXT_FIELD_CREATE,
    ToolManager.ToolMode.FORM_RADIO_GROUP_CREATE,
    ToolManager.ToolMode.FORM_COMBO_BOX_CREATE,
    ToolManager.ToolMode.FORM_LIST_BOX_CREATE
};
ToolManagerBuilder tmBuilder = ToolManagerBuilder.from()
    .disableToolModes(toolModes);
    
// Add ToolManagerBuilder to your ViewerConfig
ViewerConfig config = new ViewerConfig.Builder()
    .fullscreenModeEnabled(true)
    .multiTabEnabled(true)
    // ...
    .toolManagerBuilder(tmBuilder)
    .build();
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
// Create a custom ToolManager with disabled form field creation
val toolModes = arrayOf(
    ToolManager.ToolMode.FORM_CHECKBOX_CREATE,
    ToolManager.ToolMode.FORM_SIGNATURE_CREATE,
    ToolManager.ToolMode.FORM_TEXT_FIELD_CREATE,
    ToolManager.ToolMode.FORM_RADIO_GROUP_CREATE,
    ToolManager.ToolMode.FORM_COMBO_BOX_CREATE,
    ToolManager.ToolMode.FORM_LIST_BOX_CREATE
)
val tmBuilder = ToolManagerBuilder.from()
    .disableToolModes(toolModes)

// Add ToolManagerBuilder to your ViewerConfig
val config = ViewerConfig.Builder()
    .fullscreenModeEnabled(true)
    .multiTabEnabled(true)
    // ...
    .toolManagerBuilder(tmBuilder)
    .build()
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="API guide" %}

## API to programmatically create form fields in Android

To create new form fields and widget annotations within a new document.

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
// Create a blank page
PDFDoc doc = new PDFDoc();
Page blank_page = doc.pageCreate();

// Create a new text field and text widget/annotation (aka AcroForms).
Field text_field = doc.FieldCreate("employee.name", Field.e_text);
TextWidget text = TextWidget.Create(doc, new Rect(110, 660, 380, 690), text_field);
text.SetFont(Font.Create(doc, Font.StandardType1Font.e_times_bold));
text.RefreshAppearance();
blank_page.AnnotPushBack(text);

// Create a new signature field and signature annotation (aka AcroForms)
DigitalSignatureField sig_field = doc.CreateDigitalSignatureField("employee.signature");
SignatureWidget signature = SignatureWidget.Create(doc, new Rect(0, 100, 200, 150), sig_field);
signature.RefreshAppearance();
blank_page.AnnotPushBack(signature);

// Create a new checkbox field and checkbox widget/annotation (aka AcroForms)
Field checkbox_field = doc.FieldCreate("employee.checkbox", Field.e_check);
CheckBoxWidget checkbox = CheckBoxWidget.Create(doc, new Rect(190, 490, 250, 540), checkbox_field);
checkbox.SetBackgroundColor(new ColorPt(1, 1, 1), 3);
checkbox.SetBorderColor(new ColorPt(0, 0, 0), 3);
checkbox.SetChecked(true); // Check the widget (by default it is unchecked).
checkbox.RefreshAppearance();
blank_page.AnnotPushBack(checkbox);

// Create a radio button group and add three radio button widget/annotation (aka AcroForms) in it.
RadioButtonGroup radio_group = RadioButtonGroup.Create(doc, "employee.radiogroup");
RadioButtonWidget radiobutton1 = radio_group.Add(new Rect(140, 410, 190, 460));
radiobutton1.SetBackgroundColor(new ColorPt(1, 1, 0), 3);
radiobutton1.RefreshAppearance();
RadioButtonWidget radiobutton2 = radio_group.Add(new Rect(310, 410, 360, 460));
radiobutton2.SetBackgroundColor(new ColorPt(0, 1, 0), 3);
radiobutton2.RefreshAppearance();
RadioButtonWidget radiobutton3 = radio_group.Add(new Rect(480, 410, 530, 460));
radiobutton3.EnableButton(); // Enable the third radio button. By default the first one is selected
radiobutton3.SetBackgroundColor(new ColorPt(0, 1, 1), 3);
radiobutton3.RefreshAppearance();
radio_group.AddGroupButtonsToPage(blank_page);

// Add the page as the last page in the document.
doc.pagePushBack(blank_page);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
// Create a blank page
val doc = PDFDoc()
val blank_page = doc.pageCreate()

// Create a new text field and text widget/annotation (aka AcroForms).
val text_field = doc.fieldCreate("employee.name", Field.e_text);
val text = TextWidget.Create(doc, Rect(110.0, 660.0, 380.0, 690.0), text_field);
text.font = Font.create(doc, Font.e_times_bold));
text.refreshAppearance();
blank_page.annotPushBack(text);

// Create a new signature field and signature annotation (aka AcroForms)
val sig_field = doc.createDigitalSignatureField("employee.signature");
val signature = SignatureWidget.Create(doc, Rect(0.0, 100.0, 200.0, 150.0), sig_field);
signature.refreshAppearance();
blank_page.annotPushBack(signature);

// Create a new checkbox field and checkbox widget/annotation (aka AcroForms)
val checkbox_field = doc.fieldCreate("employee.checkbox", Field.e_check);
val checkbox = CheckBoxWidget.Create(doc, Rect(190.0, 490.0, 250.0, 540.0), checkbox_field);
checkbox.setBackgroundColor(ColorPt(1.0, 1.0, 1.0), 3);
checkbox.setBorderColor(ColorPt(0.0, 0.0, 0.0), 3);
checkbox.isChecked = true; // Check the widget (by default it is unchecked).
checkbox.refreshAppearance();
blank_page.annotPushBack(checkbox);

// Create a radio button group and add three radio button widget/annotation (aka AcroForms) in it.
val radio_group = RadioButtonGroup.create(doc, "employee.radiogroup")
val radiobutton1 = radio_group.add(Rect(140.0, 410.0, 190.0, 460.0))
radiobutton1.setBackgroundColor(ColorPt(1.0, 1.0, 0.0), 3)
radiobutton1.refreshAppearance()
val radiobutton2 = radio_group.add(Rect(310.0, 410.0, 360.0, 460.0))
radiobutton2.setBackgroundColor(ColorPt(0.0, 1.0, 0.0), 3)
radiobutton2.refreshAppearance()
val radiobutton3 = radio_group.add(Rect(480.0, 410.0, 530.0, 460.0))
radiobutton3.enableButton() // Enable the third radio button. By default the first one is selected
radiobutton3.setBackgroundColor(ColorPt(0.0, 1.0, 1.0), 3)
radiobutton3.refreshAppearance()
radio_group.addGroupButtonsToPage(blank_page)

// Add the page as the last page in the document.
doc.pagePushBack(blank_page)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDF interactive forms (AcroForms)](/android/get-started/samples.md#interactiveforms) Full code sample which illustrates some basic PDFNet capabilities related to interactive forms (also known as AcroForms).

## About creating form fields

Regardless of which field type you create, you must provide a Field name:

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Field my_field = doc.FieldCreate("address", Field.e_text);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val my_field = doc.fieldCreate("address", Field.e_text)
```

{% endcode %}
{% endtab %}
{% endtabs %}

Under most circumstances, field names must be unique. If you have a field you name as "address" and you create a second field you likewise call "address", you cannot supply different data in the two fields.

Field names can use alphanumeric characters to identify a field. All field names are case-sensitive. For example, you can use names such as empFirstName, empSecondName, empNumber, and so on for a group of fileds that are related to the same concept (in our sample employee entity).

Another technique for naming fields is to use a parent and child name. For example, you could name the above fields as follows: `employee.name.first`, `employee.name.second`, `employee.number`.

This naming convention is not only useful for organizing purposes but is well-suited for automatic operations on Fields. In the Apryse SDK, `Field.GetName()` returns a string representing the fully qualified name of the field (e.g. "employee.name.first"). To get the child name ("first") use the `Field.GetPartialName()` method.

For more information about adding Fields, see the [FDF code sample ](/android/get-started/samples.md#fdf).

## Understand field types

PDF offers six different field types. Each type of form field is used for a different purpose, and they have different properties, appearances, options, and actions that can be associated with the fields. In this section, we will explain how to create all the seven field types and some attributes specific to each one.

Common field types are text-box, checkbox, radio-button, combo-box, and push-button. To find out the type of the Field use `Field.GetType()` method:

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
int type = field.GetType();
switch (type)
{
  case Field.e_button:
    System.out.println("Button");
    break;
  case Field.e_check:
    System.out.println("Check");
    break;
  case Field.e_radio:
    System.out.println("Radio");
    break;
  case Field.e_text: {
    System.out.println("Text");
    break;
  case Field.e_choice:
    System.out.println("Choice");
    break;
  case Field.e_signature:
    System.out.println("Signature");
    break;
}
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val type = field.getType()
when (type)
{
  Field.e_button -> println("Button")
  Field.e_check -> println("Check")
  Field.e_radio -> println("Radio")
  Field.e_text -> println("Text")
  Field.e_choice -> println("Choice")
  Field.e_signature -> println("Signature")
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/android/forms/create-fields.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
