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

First row from multiline textfield

Explorer ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

Hi,

how can I extract the first line of a multiline textfield into a variable with javascript?

The thing is I would like to use a multiline textfield for the address so that I don't need to use a lot of separate textfields.

I need to extract the first line of it to get the client name (which always would be the first line of that field)

Best regards

TOPICS
Acrobat SDK and JavaScript , Windows

Views

368

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 , Jan 26, 2018 Jan 26, 2018

Use this code:

this.getField("Text1").valueAsString.split("\r")[0]

Replace "Text1" with the actual field name, of course.

Votes

Translate

Translate
Community Expert ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

Use this code:

this.getField("Text1").valueAsString.split("\r")[0]

Replace "Text1" with the actual field name, of course.

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
Explorer ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

Thank you very much!

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
LEGEND ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

LATEST

If one has a series of different forms with the same type of fields it might be better to obtain the data at the smallest break down and then create the combined fields. All of this data could be held in an exported FDF file and then that file could be imported into any form to automatically fill-in only the form field with same name of the field in the FDF. An example of this approach was provided in the early versions of the Acrobat distribution CD-Rom

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