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

Remove Form field numbers after multiple pages are added to pdf

New Here ,
Jan 16, 2019 Jan 16, 2019

Copy link to clipboard

Copied

I need to remove the #number on forms after pages are added for scripts. All pages after the first are identical ordering but scripts will not work after first page.

Page 1

pdf-1.PNG

Page 2

pdf 2.PNG

EXAMPLE SCRIPT

GLOBAL

// initialize the auto-populate data to an empty object.

var oContactData_Ex7 = {};

// Read contents of file attachment into a string

// Assume there is only one file attachment

var stmCSVFile = this.getDataObjectContents(this.dataObjects[0].name);

var strCSVFile = util.stringFromStream(stmCSVFile);

// Parse data into object

// First Split into lines

var aLines = strCSVFile.split(/[\r\n]{1,2}/);

// Grab column names

var aColNames = aLines.shift().split(",");

// loop over lines and fill object

for(var i=0;i<aLines.length;i++)

{// only operate on non-empty lines

   if(!/^\s*$/.test(aLines))

   {  // split out data items on line

      var aEntries = aLines.split(",");

      oContactData_Ex7[aEntries[0]] = {};

      for(var n=1;n<aEntries.length;n++)

         oContactData_Ex7[aEntries[0]][aColNames] = aEntries;

   }

}

// Build array of selection item names from the data object

var aNames = [" - "];

for(var cName in oContactData_Ex7)

  aNames.push(cName);

//Add blank entry to data

oContactData_Ex7[" - "] = {mailStop:"", email:"", department:"", phone:""};

// Get the drop down field

var oDropFld = this.getField("Ex7.ContactDropDown");

// Save previous selection value

var bBlockEx7 = true;

var oldValue = oDropFld.value;

// Fill drop down with names

oDropFld.setItems(aNames);

// Restore previous selection value

if(oldValue && /^\S+$/.test(oldValue))

   oDropFld.value = oldValue;

bBlockEx7 = false;

CUSTOM KEYSTROKE

if(event.willCommit && !bBlockEx7)

{

   var oEntry = oContactData_Ex7[event.value];

   if(oEntry)

   {// If entry exists fill in the fields

      // Loop through the names of each entry

      // Each entry name must match a field name on the form

      for(var cName in oEntry)

      {

          var oFld = this.getField("Ex7." + cName);

          if(oFld)

             oFld.value = oEntry[cName];

      }

   }

   else

   {

    // Place code for custom entry here. 

   }

}

TOPICS
Acrobat SDK and JavaScript

Views

99

Likes

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

correct answers 1 Correct answer

Community Expert , Jan 17, 2019 Jan 17, 2019

You can't remove them. They indicate that that field is a part of a group of fields with identical names. Your code should not be affected by that, though. If you want to "remove" them you need to rename the field to something else.

Likes

Translate

Translate
Community Expert ,
Jan 17, 2019 Jan 17, 2019

Copy link to clipboard

Copied

LATEST

You can't remove them. They indicate that that field is a part of a group of fields with identical names. Your code should not be affected by that, though. If you want to "remove" them you need to rename the field to something else.

Likes

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