Copy link to clipboard
Copied
var f = this.addField("myfield","text",0,[0,792,126,770]);
f.borderColor = color.black;
f.textSize=12;
f.textColor=color.black;
It works fine but positions the text field in the top corner of the page, whereas with LiveCycle it was simple to make a new field below an existing one, then another each time the button was clicked. Can anyone help me with this please?
You can use other values for the parameter "oCoords".
Copy link to clipboard
Copied
You can use other values for the parameter "oCoords".
Copy link to clipboard
Copied
Thank you both for your replies. Your solutions work for the first instance but how do you then add subsequent instances and then later remove them if they're not needed? I found how to unhide then hide a page which is sort of a solution but rather cumbersome, a row by row solution is what I'm striving for, maybe it's not possible with Acrobat DC?
Copy link to clipboard
Copied
You need to either create the fields in advance and then show/hide them as needed, or add them (using addField) and delete them (using removeField) as needed. This is not a simple task, though, because each time you remove a field from the middle of the "table" you'll need to move all the ones after it up, to take its place.
Copy link to clipboard
Copied
If you want to place the field under another field then you need to first read the rect property of the first field, adjust it by changing the y coordinates (1 and 3 in the rect array) to new values, and then use that when creating your new field.