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

searching content of multi line Text Field

Community Beginner ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Hello

i have a large multi line Text Field that contain multiple visits with a certain Date configurations

something like this (Sunday 06/01/2019):

I was able to collect them through RegEx and put them in a popUpMenu through this code:

function ShowVisits() {

var keyword = /[(](\w{6,9})\s(\d{1,2})[/](\d{1,2})[/](\d{4})[)][:]/g

var str = this.getField("HistoryT").value;

var match = str.match(keyword);

var begining = ["Visits"];

var aGhazali = match.unshift(begining)

var cRtn = app.popUpMenu(match)

}

What I would like to do now is to modify the function to search in the content of the Text Field  and do something like setting focus or scroll down to where the match is.

I have tried to search using the built in Find but it only finds the match if it is available in the screen, but if its need to be scrolled to find will show no matching is found

thanks

TOPICS
Acrobat SDK and JavaScript , Windows

Views

382

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 , May 08, 2019 May 08, 2019

That is not possible.

Votes

Translate

Translate
Community Expert ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

That is not possible.

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 ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

LATEST

There is no straight forward way to do this.  The only way to select text within a text field is through the Keystroke event.  And I do now know if this would result in the text field scrolling to a specific position. But you could try. Unfortunately there is only way to get an uncommitted keystroke event, and that is for the user to click into the text field. So you'd have to first select from the dropdown, and then click into the text field.

Look up the event.selStart and event.selEnd properties of the Event object.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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