Copy link to clipboard
Copied
I found this article that talks about rename all duplicate field names.
for (var i=0;i<200;i++)
{
try{
var ts=this.getField("Name1."+i).textSize;
var tf=this.getField("Name1."+i).textFont;
var rct=this.getField("Name1."+i).rect;
var pg=this.getField("Name1."+i).page;
var f=this.addField("name."+i,"text",pg,rct);
f.textSize=ts;
f.textFont=tf;
}catch(e){break}
}
this.removeField("Name1");
I believed this script is for text box. I need to rename all my duplicate checkbox names. Do I sipmly changed the "text" to "checkbox" for checkbox field instead of text box field? I tried that and it didn't really work. I no longer can click on the checkbox once I ran this script. Any suggestion is much appreciated.
Use this code:
for(var i = 0; i< 61; i++){
if(this.getField("T Neej."+i)!= null){
var ts=this.getField("T Neej."+i).textSize;
var tf=this.getField("T Neej."+i).textFont;
var rct=this.getField("T Neej."+i).rect;
var pg=this.getField("T Neej."+i).page;
var f=this.addField("checkBox"+i,"checkbox",pg,rct);
f.textSize=ts;
f.textFont="ZapfDingbats";
this.removeField("T Neej."+i);
}
}
Copy link to clipboard
Copied
If they all start with "Name1." then you can do it like this:
this.getField("Name1").getArray().length;
Copy link to clipboard
Copied
This didn't look right because it only shows 1.
this.getField("Name1").getArray().length;
Copy link to clipboard
Copied
this.getField("Name1").getArray().length;