Extract specific text (or number) value from field

Participant ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Hi all,

 

Am wondering if it is possible (with JavaScript?) to extract specific text or text/numeric value from a separate field that a user has entered a value? e.g. - If "Text1" has a user entered value of "joe bloggs 2021", is it possible in "Text2" field, to extract only the "2021" value from the user entered text string, and populate that value (i.e. "2021") in to the "Text1" field??.

 

Thanks..... 

TOPICS
PDF forms

Views

103

Likes

translate

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

Adobe Community Professional , Apr 22, 2021 Apr 22, 2021
Use this as 'validation' script of 'Text1' field: this.getField("Text2").value = event.value.split(" ").pop();

Likes

translate

Translate

Translate
Adobe Community Professional ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Use this as 'validation' script of 'Text1' field:

this.getField("Text2").value = event.value.split(" ").pop();

Likes

translate

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
Participant ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Thanks Nesa! 😉

Likes

translate

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
Most Valuable Participant ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

The code above will work, but will allow the user to overwrite that value (unless Text2 is set to read-only).

If you don't want that then you should use a calculation script for Text2, instead.

Likes

translate

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