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

Populating two text fields from one dropdown

Explorer ,
Dec 04, 2020 Dec 04, 2020

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
836
Translate
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.

Translate
Enthusiast ,
Dec 04, 2020 Dec 04, 2020

How do you export to TEXT1?

Translate
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

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

MemYear.JPG

Translate
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

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

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

Translate
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

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.

Translate
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
LATEST

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

 

Translate
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

Replace :

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

 

By:

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


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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