Populating two text fields from one dropdown

Community Beginner ,
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, Create PDFs, PDF forms

Views

72

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 , 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

Translate
Engaged ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

How do you export to TEXT1?

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
Community Beginner ,
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

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 Beginner ,
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

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
Adobe Community Professional ,
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

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 Beginner ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

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

 

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
Adobe Community Professional ,
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

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