New to Telerik Document ProcessingStart a free 30-day trial

FormField

Updated on Jun 3, 2026

Form fields are the data containers responsible for preserving separate pieces of the interactive form data. Several types of form fields exist, each responsible for preserving a different type of data.

FormField Class

The FormField class is the base class for all fields. You can find instances of this class by iterating the FormFieldCollection of AcroForm.

You can find complete examples for Creating Interactive Forms and Modifying Forms in the SDK repository.

FormField Properties

The FormField class provides the following properties:

PropertyDescription
FieldTypeGets the FormFieldType of the specific field instance. Use this property to recognize the type of the concrete field and cast the instance to the concrete FormField class inheritor.
NameGets or sets the name of the field. Each field must have a unique name when added to a FormFieldCollection of an AcroForm. Setting the name is available starting with R2 2020.
UserInterfaceNameGets the name used by the UI when referencing the field. Typically shown in a tooltip when hovering the field representation on the page. Also shown in error messages related to field error calculations.
MappingNameGets the name used when exporting the field data from the document.
IsReadOnlyGets or sets a Boolean value indicating whether the field is treated as read-only in a PDF viewer UI.
IsRequiredGets or sets a Boolean value indicating whether the field is required for submitting the interactive form data.
ShouldBeSkippedGets or sets a Boolean value indicating whether the field is skipped when submitting the form.
TextPropertiesGets a VariableTextProperties instance used when creating a Widget for visualizing the concrete field. These properties dynamically construct the Widget appearance when it contains text content.

FormField Types

You can recognize each field type from the FormField base class by getting the value from its FieldType property. This allows you to convert the field to its inheritor type by casting to one of the FormField class inheritors.

Example 1: Obtain fields from a document

C#
using (Stream stream = File.OpenRead("InteractiveForms.pdf"))
{
    RadFixedDocument document = new PdfFormatProvider().Import(stream, TimeSpan.FromSeconds(10));
    foreach (FormField field in document.AcroForm.FormFields)
    {
        switch (field.FieldType)
        {
            case FormFieldType.TextBox:
                ProcessTextBox((TextBoxField)field);
                break;
            case FormFieldType.ListBox:
                ProcessListBox((ListBoxField)field);
                break;
            case FormFieldType.RadioButton:
                ProcessRadioButtons((RadioButtonField)field);

                break;
            case FormFieldType.CheckBox:
                ProcessCheckBoxes((CheckBoxField)field);
                break;
        }
    }

}

The following list shows all the inheritors of the FormField class:

Rename Form Fields

Starting with R2 2020, the Rename method allows you to rename form fields. Pass the existing field name and the new name.

Example 2: Rename form fields

C#
public void RenameFields(RadFixedDocument document)
{
    document.AcroForm.FormFields.Rename("OldName", "NewName");
}

Merging Documents with Form Fields

When merging documents that contain form fields, you must ensure that each field in the document has a unique name. Use the MergedFieldNameResolving event to achieve this. This event gives you access to all used field names and allows you to change the current field name if it is already in use.

Example 3: Merge files with form fields

C#
public void MergeFields()
{
    PdfFormatProvider provider = new PdfFormatProvider();
    var document = provider.Import(File.ReadAllBytes(@"D:\FormFieldDoc.pdf"), TimeSpan.FromSeconds(10));
    var document1 = provider.Import(File.ReadAllBytes(@"D:\FormFieldDoc1.pdf"), TimeSpan.FromSeconds(10));

    document.MergedFieldNameResolving += Document_MergedFieldNameResolving;

    document.Merge(document1);

    using (FileStream fs = new FileStream(@"MergedResult.pdf", FileMode.OpenOrCreate))
    {
        provider.Export(document, fs, TimeSpan.FromSeconds(10));
    }

}

private void Document_MergedFieldNameResolving(object sender, MergedFormFieldNameResolvingEventArgs e)
{
    if (e.UsedNames.Contains(e.Name))
    {
        e.NewName = e.Name + "1";
    }
}

See Also