Copy link to clipboard
Copied
I am troubleshooting an Acrobat form with a lot of Yes/No checkboxes. I've created separate group names for each set of boxes, but apparently there are duplicates somewhere, for when I tried to make copies of the fields (to edit afterwards) I got the message "Cannot create multiple copies of this selection. One or more fields in the selection have duplicated in this form."
So I searched the community here and found a javascript to locate duplicate fields:
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.type=="text" && typeof f.page=="object") {
console.println(f.name + ":" + f.page);
}
}
and ran it in the Javascript Consol/Debugger, but I would get the error message:
SyntaxError: syntax error
1:Console:Exec
undefined
so am I doing something wrong?
Each button already has a run javascript action on mouse up, could that be interfering somehow?
if (event.shift) event.target.value = "Off"
Any help would be greatly appreciated.
Select the whole code and execute it.
The code will find duplicate form text fields.
Correct. You can remove this part of the code (which I believe I wrote, by the way) to process all fields, not just text fields:
f.type=="text" &&
However, this means that it will list all radio-buttons and check-boxes which have more than one widget in the group.
To avoid that you can replace the above with this:
f.type!="radiobutton" && f.type!="checkbox" &&
Then it will report about duplicate fields of all other types, except those two.
Copy link to clipboard
Copied
Select the whole code and execute it.
The code will find duplicate form text fields.
Copy link to clipboard
Copied
You'll find a tutorial here on using the console window:
https://www.pdfscripting.com/public/Free_Videos.cfm#JSIntro
Copy link to clipboard
Copied
Ok, I ran it and it came back with "undefined" so that would mean no duplicate fields?
Copy link to clipboard
Copied
Then you have no duplicate text fields.
Copy link to clipboard
Copied
Correct. You can remove this part of the code (which I believe I wrote, by the way) to process all fields, not just text fields:
f.type=="text" &&
However, this means that it will list all radio-buttons and check-boxes which have more than one widget in the group.
To avoid that you can replace the above with this:
f.type!="radiobutton" && f.type!="checkbox" &&
Then it will report about duplicate fields of all other types, except those two.