• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
4

Enforcing Unique Descriptions to Forms

New Here ,
Mar 28, 2024 Mar 28, 2024

Copy link to clipboard

Copied

We are using annotated forms within an application and are attempting to create a function that will allow us to modify a PDF form (in Acrobat) and then re-attach the mappings we're using from our application to the appropriate annotated field (we call them mappings). The initial challenge for us was that we had been creating the mapping using the annotation-id however, this identifier changes on fields even when very minor adjustments are made to it, defeating our goal. As a workaround, we believe the best solution for us is to begin mapping our application to the annotated field descriptions instead of the ids. This now presents us with a unique challenge in that if I create a PDF form with two fields called "Name", Acrobat has logic to rename the duplicate as "Name#2", except when I save the form and look at it programatically, I see "Name" as both descriptions (removing the uniqueness). Is there any way to enforce unique descriptions within Acrobat so that it doesn't do this magic addition of #2 and instead requires the user to use a different name?

TOPICS
PDF forms

Views

296

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2024 Mar 28, 2024

Copy link to clipboard

Copied

Use unique names for the fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2024 Mar 28, 2024

Copy link to clipboard

Copied

While I can appreciate that this is the simple answer, that's like saying "never make a mistake". One of the nice things about software is that it can often times help avoid user error (form validation, data types in a db, the list is pretty long). I think the part that has me asking the question is the fact that there is some "magic" happening to allow duplicate names inside Acrobat and I just want to disable this magic to enforce uniqueness. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2024 Mar 28, 2024

Copy link to clipboard

Copied

There's no such setting. It is possible to use a script to report when there are duplicate fields in the file, but you'll have to run it yourself each time. It can't just run in the background and notify you when that happens.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2024 Mar 28, 2024

Copy link to clipboard

Copied

LATEST

By mappings I'm assuming you mean form field placement? If this is the case then use the "replace pages" feature, on the "Organize Pages" tool set.  Replacing pages does not remove the form fields, it only swaps out the page content. So you can make changes to the page content convert it to PDF, and then add it back into the original form. 

 

BTW: the #1, #2, attached to the field name in the "prepare form" tools is the widget number.  This number is identified to a certain extent in the "page" property of the field.  If there is more then one field widget, then the page property will be an array of pages, the widget number is the index of the array. 

The field object for a specific widget can be acquired using the widget number attached to the field name with a "."

For example:  this.getField("MyTextField.1") 

This code gets the second widget of the "MyTextField", because widget number start at 0.

 

You can read more about forms here:

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines