Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for ASP.NET Core

Form Fields concept

The form fields are the data containers responsible for preserving separate pieces of the interactive form data. There are several types of form fields responsible for preserving different type of data.

FormField Class

FormField class is the base class for all fields. Instances of this class may be found by iterating in the FormFieldCollection of AcroForm.

FormField Properties

The FormField class provides the following properties:

  • FieldType: Provides the FormFieldType of the specifying field instance. This property can be used to easily recognize the type of the concrete field and easily cast the instance to the concrete FormField class inheritor.

  • Name: Provides the name of the field. Each field should have a unique name when added to a FormFieldCollection of an AcroForm.

  • UserInterfaceName: Provides name used by the UI when referencing the field. Usually shown in a tooltip when hovering the field representation on the page. Also shown in error messages related to field error calculations.

  • MappingName: Name used when exporting the field data from the document.

  • IsReadOnly: Boolean value indicating whether the field should be threated as read-only in a PDF viewer UI.

  • IsRequired: Boolean value indicating whether the field is required for submitting the interactive form data.

  • ShouldBeSkipped: Boolean value indicating whether the field should be skipped when submitting the form.

  • TextProperties: Represents a VariableTextProperties instance used when creating Widget for visualizing the concrete field. These properties are used to dynamically construct the Widget appearance when it contains some text content.

FormField Types

Each field type can be recognized from the FormField base class by getting the value from its FieldType property. This way you can convert the field to its inheritor type by doing a cast to some of the FormField class inheritors.

Example 1: Obtain fields from a document

using (Stream stream = FileHelper.GetSampleResourceStream("InteractiveForms.pdf")) 
    RadFixedDocument document = new PdfFormatProvider().Import(stream); 
    foreach (FormField field in document.AcroForm.FormFields) 
        switch (field.FieldType) 
            case FormFieldType.TextBox: 
            case FormFieldType.ListBox: 
            case FormFieldType.RadioButton: 
            case FormFieldType.CheckBox: 
The following list shows all the inheritors of the FormField class:

See Also

In this article
Not finding the help you need? Improve this article