Completed
Last Updated: 30 Mar 2020 06:39 by ADMIN
Release R2 2020
ADMIN
Polya
Created on: 16 May 2018 14:37
Category: PdfProcessing
Type: Feature Request
6
PdfProcessing: Provide a way to rename FormFields
Provide a way to change the Name of a FormField from the RadDocument.AcroForm.FormFields collection.

As a workaround, you could create a new instance of a FormField with the desired name, add the new field in the document and remove the old one. You can use the following approach:
   1) Create a new instance of FormField (with the desired name, passed in the constructor), which will play the role of a copy of a specific FormField
   2) Copy all properties from the original field (they all vary, depending on the concrete type of the FormField, for example CheckBoxField, etc.)
   3) Create a new widget for the new field, and copy all properties from the original field's widget into the new one.
   4) Remove the original field from the RadDocument.AcroForm.FormFields collection and add the new field.
   5) Remove the original widget from the corresponding page's annotation and add the new one.

Attached is a project demonstrating this approach for a CheckBoxField.
4 comments
ADMIN
Tanya
Posted on: 02 Aug 2019 08:21
Hi Hector,

You should be indeed careful with this solution as it doesn't update the name of the field in the internal collections (in the AcroForm, for example).

The task is still included in our planing processes but it has been scheduled for implementation during the current release. Please, continue following it so we can update you when the status of the item changes. 

Regards,
Tanya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Hector
Posted on: 26 Jul 2019 21:25

Wanted to share the method that I use to rename a form field:

 

        public static void Rename(this FormField field, string newFieldName)
        {
            if (field == null) return;

            typeof(FormField)
                .GetField("name", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public)
                .SetValue(field, newFieldName);
        }

 

I'm not sure if there are other internal processes that this would mess up, but so far this hasn't affected anything on the PDFs that I can tell, and I'd wager it's much more performant. Be wary of using it over the Telerik provided solution however!

 

Does Telerik still plan on exposing the SET operation of this property or something similar?

ADMIN
Martin
Posted on: 23 Nov 2018 12:48
Hi,

Attached is a project demonstrating the workaround for a RadioButtonField. 

I hope that this suits your needs.

Regards,
Martin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
GuiGuiGui
Posted on: 15 Nov 2018 21:28
Has anyone done this for a Radio Button? I think you have several widgets for the radio button and only one form field? Whereas TextBox, ListBox, Checkbox are one-to-one widget to form field?