Copy link to clipboard
Copied
Using javascript , it's possible to set all the Appearance options to multiple text fields using hierarchic names. But I noticed that I can't do this for any of the General (readonly) or Options options (multiline true/false or defaultValue). I'm trying to have a functions that create three text fields with specific attributes. Here my code... Maybe I'm approaching it the wrong way and shall create one field and duplicate it using javascript. But I don't know how (yet! 🙂 )
addField("jv.n", "text", this.pageNum, [18, 18, 582, 162]);
addField("jv.m", "text", this.pageNum, [18, 186, 582, 330]);
addField("jv.0", "text", this.pageNum, [18, 354, 582, 498]);
var fNa = ("jv");
var f = this.getField(fNa);
f.textSize = 10;
f.textFont = "Courier";
f.textColor = color.black;
f.fillColor = ["G", 0.9];
f.display = display.visible;
f.multiline = true;
f.doNotScroll = false;
f.doNotSpellCheck = true;
f.readonly = true;
f.defaultValue = "JavaScript - description: ";
this.resetForm("jv");
Copy link to clipboard
Copied
You should be able to get the individual fields and set the properties you want. E.g.,
var f1 = addField("jv.n", ...);
f1.multiline = true;
// etc.
Copy link to clipboard
Copied
Georges, I have try it with var f1 = addField ("jv.n"...) for all three but only the last one get it. I ended up using the same name for the three fields (I will manually edit them anyways).
var f = addField("jv", "text", this.pageNum, [18, 18, 582, 162]);
var f = addField("jv", "text", this.pageNum, [18, 186, 582, 330]);
var f = addField("jv", "text", this.pageNum, [18, 354, 582, 498]);
f.textSize = 10;
f.textFont = "Courier";
f.textColor = color.black;
f.fillColor = ["G", 0.9];
f.display = display.visible;
f.multiline = true;
f.doNotScroll = false;
f.doNotSpellCheck = true;
f.readonly = true;
f.defaultValue = "JavaScript - description: ";
this.resetForm("jv");