Questions on dependent dropdown lists

New Here ,
May 29, 2019 May 29, 2019

Copy link to clipboard

Copied

Hi,

I am using PDF Forms. I having basic skills on Javascript, so I have some questions to clarify about the below code. I have seen codes created for dependent dropdpwn list in the forum and I tried to make use of it.

I have created dropdown list1 called "Country." I set "USA and UK" as items in the dropdown list. Now, depending on that choice, dropdown list2 called "City" will have different cities to select from.

First question, is my following code correct to achieve my objective?

  1. switch (event.value) { 
  2.     case "US"
  3.         this.getField("City").setItems(["NY","SN"]); 
  4.         break; 
  5.     case "UK"
  6.         this.getField("City").setItems(["London","Liverpool"]); 
  7.         break;       

Second question, where I have to add this code ? is it for "Country" or for "City" properties ?

Third question, what does (event.value) mean ? is it changing depends on the dropdown list name ?

Thanks a lot.

TOPICS
PDF forms

Views

248

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 , May 29, 2019 May 29, 2019

1. Yes, seems fine.

2. As the custom validation script of "Country".

3. It refers to the newly selected value of the drop-down field. The name of that field doesn't matter.

Likes

Translate

Translate
Community Expert ,
May 29, 2019 May 29, 2019

Copy link to clipboard

Copied

1. Yes, seems fine.

2. As the custom validation script of "Country".

3. It refers to the newly selected value of the drop-down field. The name of that field doesn't matter.

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
New Here ,
May 30, 2019 May 30, 2019

Copy link to clipboard

Copied

LATEST

Thank.

That helps and code is working 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