• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Aug 15, 2019 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

664

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Aug 16, 2019 Aug 16, 2019

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

Votes

Translate

Translate
Community Expert ,
Aug 16, 2019 Aug 16, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2019 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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2019 Aug 18, 2019

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2019 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.

Votes

Translate

Translate

Report

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