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

Populating two text fields from one dropdown

Explorer ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

I am attempting to create a PDF membership form for my sports club and am stuck on one thing.  I have a dropdown "MemYear" that is set with options "2020/2021", 2021/2022, and so on.  When you select 2020/2021 it exports a value of "30 Sep 2020" to "TEXT1", 2021/2022 exports "30 Sep 2021" and so on/  If it is possible, I would like it so that in addition to the first export to TEXT1 it will also export "December 2020" to TEXT2 and when I select the next option it would export December 2021 and so on.


I can figure out the first part of exporting to TEXT1,  but am stumped on how to complete step 2, i.e exporting to TEXT2.   Any help would be greatly appreciated as this one really has me baffled.

Thanks in advance

TOPICS
Acrobat SDK and JavaScript

Views

108

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
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 05, 2020 Dec 05, 2020

Try this in TEXT2 field:

var drop = this.getField("MemYear").value;
if(drop == "30 Sep 2021"){
event.value = "30 Dec 2021";}
else if(drop == "30 Sep 2022"){
event.value = "30 Dec 2022";}
else event.value = "";

 

You see how it works so add more options as needed.

Likes

Translate

Translate
Enthusiast ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

How do you export to TEXT1?

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
community guidelines
Explorer ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

Hi Asim123, I use the Export Value feature in the OPTIONS tab of the dropdown box (MemYear) as per below.

MemYear.JPG

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
community guidelines
Explorer ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

sorry forgot to include that I use the following Custom Calcualtion Script in TEXT1

event.value = this.getField("MemYear").value;

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
community guidelines
Community Expert ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

Try this in TEXT2 field:

var drop = this.getField("MemYear").value;
if(drop == "30 Sep 2021"){
event.value = "30 Dec 2021";}
else if(drop == "30 Sep 2022"){
event.value = "30 Dec 2022";}
else event.value = "";

 

You see how it works so add more options as needed.

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
community guidelines
Explorer ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

LATEST

Thank you, everyone, especially Nesa Nurani - your solution worked perfectly

 

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
community guidelines
Community Expert ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

Replace :

event.value = this.getField("MemYear").value;

 

By:

event.value = this.getField("MemYear").valueAsString;

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
community guidelines