searching content of multi line Text Field

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

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

That is not possible.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

120

Likes

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

searching content of multi line Text Field

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

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

That is not possible.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

121

Likes

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
May 08, 2019 0
Most Valuable Participant ,
May 08, 2019

Copy link to clipboard

Copied

That is not possible.

Likes

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
Reply
Loading...
May 08, 2019 0
Adobe Community Professional ,
May 08, 2019

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
May 08, 2019 1