I use the following script to dynamically make a button add a text field.

New Here ,
Aug 15, 2019

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?

TOPICS
Acrobat SDK and JavaScript

Views

103

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Aug 16, 2019
Bernd Alheit Adobe Community Professional , Aug 16, 2019
You can use other values for the parameter "oCoords".

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Aug 16, 2019

Copy link to clipboard

Copied

You can use other values for the parameter "oCoords".

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Aug 18, 2019

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?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
try67 LATEST
Most Valuable Participant ,
Aug 18, 2019

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Aug 16, 2019

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more