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

How to populate different dropdown list based on selection of a value in another dropdown field?

New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Hi there,

I'm trying to create a fillable form in Acrobat Pro where I select a  value in dropdown field A, dropdown field B will only display a list of values pertaining to the value in A.

Thanks.

TOPICS
PDF forms

Views

9.8K

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 , Mar 18, 2021 Mar 18, 2021

Use setItems() to populate dropdown field, here is an example code:

if(event.value == "Item1")
this.getField("Dropdown2").setItems(["Item 1","Item 2","Item 3"]);
else if(event.value == "Item2")
this.getField("Dropdown2").setItems(["Item 4","Item 5","Item 6"]);
else this.getField("Dropdown2").clearItems();

You can also give items an export value like this:

setItems([["Item 1", "1"], ["Item 2", "2"], ["Item 3", "3"]]);

Votes

Translate

Translate
Community Expert ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Use setItems() to populate dropdown field, here is an example code:

if(event.value == "Item1")
this.getField("Dropdown2").setItems(["Item 1","Item 2","Item 3"]);
else if(event.value == "Item2")
this.getField("Dropdown2").setItems(["Item 4","Item 5","Item 6"]);
else this.getField("Dropdown2").clearItems();

You can also give items an export value like this:

setItems([["Item 1", "1"], ["Item 2", "2"], ["Item 3", "3"]]);

Votes

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 ,
Mar 25, 2021 Mar 25, 2021

Copy link to clipboard

Copied

Thanks Nesa!  It worked.

Votes

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 ,
Feb 10, 2022 Feb 10, 2022

Copy link to clipboard

Copied

Where should this code be placed? I would assume in the properties of the first dropdown somewhere? Thanks!

Votes

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 ,
Feb 10, 2022 Feb 10, 2022

Copy link to clipboard

Copied

Yes, in first dropdown field properties -> Validation -> Run custom validation script.

Votes

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 ,
Feb 10, 2022 Feb 10, 2022

Copy link to clipboard

Copied

Awesome, thank you!

Votes

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 ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

Hello Nesa! When I add this to my first dropdown, my second dropdown gets cleared of items.
What am I missing here? 

Votes

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 ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

Please post script you are using.

Votes

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 ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

I tried to recreate it with your exact script

if(event.value == "Item1")
this.getField("Dropdown2").setItems(["Item 1","Item 2","Item 3"]);
else if(event.value == "Item2")
this.getField("Dropdown2").setItems(["Item 4","Item 5","Item 6"]);
else this.getField("Dropdown2").clearItems();

1 have 2 dropdowns. (Dropdown1, Dropdown2)
The script added on Dropdown2.

It looks like it only runs:

clearItems();

 

It doesnt add 'Item 1. Item 2' etc in Dropdown2

 

Votes

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 ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

Sorry! I just figured it out!

I gave exportvalue the name Item1. Thats where it went wrong.

It works now!

Votes

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 ,
Aug 07, 2023 Aug 07, 2023

Copy link to clipboard

Copied

this code only shows the value item1...it doesn't show the item2 and item3 as a dropdown list.Kindly help

Votes

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 ,
Aug 07, 2023 Aug 07, 2023

Copy link to clipboard

Copied

Post script you're trying to use, and where did you place the script?

Votes

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 ,
Mar 20, 2024 Mar 20, 2024

Copy link to clipboard

Copied

Is there a way to do this with multiple fields as "Dropdown2"?  The image below is of a Purchase Request i'm working on. The user would select the "Site" (dropdown1) and "Account Code" (dropdown2) in line 1. I want the same dropdown2 list in lines 2  - 7, but each line's selection could be different (but from the same Site). So that means I can't just duplicate the line 1 AccountCode field (or all of those fields will have the same result). For example, Line one could be Account Code "CMF51597" and Line 2 could be Account Code "CMF17400".

Robert28169806xqrq_0-1710957427577.png

 

Here's my current Java Script...

if(event.value == "CMCF")
this.getField("AccountCode1").setItems(["CMF17400","CMF17900","CMF22400","CMF51403","CMF51409","CMF51550","CMF51591","CMF51594","CMF51595","CMF51597","CMF51600","CMF51660","CMF51700","CMF61500","CMF61600","CMF61700"]);
else if(event.value == "CMCV")
this.getField("AccountCode1").setItems(["CMC13100","CMC17400","CMC17900","CMC22400","CMC51404","CMC51405","CMC51406","CMC51407","CMC51411","CMC51415","CMC51415","CMC51710","CMC51711","CMC51720","CMC51730","CMC51740","CMC51750","CMC51760","CMC51800","CMC61600","CMC63000","CMC64500","CMC64700","CMC94510"]);
else if(event.value == "DMCF")
this.getField("AccountCode1").setItems(["DMF17400","DMF17900","DMF22400","DMF51403","DMF51409","DMF51415","CMC51406","DMF51590","DMF51591","DMF51592","DMF51593","DMF51594","DMF51595","DMF51596","DMF51598","DMF51599","DMF51600","DMF51660","DMF51765","DMF61500","DMF61600","DMF61700"]);
else if(event.value == "MMCV")
this.getField("AccountCode1").setItems(["MMC17900","MMC51401","MMC51404","MMC51405","MMC51409","MMC51410","MMC51412","MMC51414","MMC51416","MMC51450","MMC51700","MMC51710","MMC51714","MMC51715","MMC51745","MMC51750","MMC51755","MMC51765","MMC51767","MMC63000"]);
else if(event.value == "SMCF")
this.getField("AccountCode1").setItems(["SMF17400","SMF22400","SMF51403","SMF51409","SMF51590","SMF51600","SMF51660","SMF61500","SMF61600","SMF61700"]);
else if(event.value == "SMCV")
this.getField("AccountCode1").setItems(["SMC13100","SMC17400","SMC17900","SMC22400","SMC51404","SMC51405","SMC51406","SMC51407","SMC51700","SMC51720","SMC51730","SMC51750","SMC61600","SMC63000","SMC64500","SMC64700"]);
else if(event.value == "TMCV")
this.getField("AccountCode1").setItems(["TMC13100","TMC17400","TMC17900","TMC22400","TMC51411","TMC51415","TMC51700","TMC51711","TMC51730","TMC51740","TMC51750","TMC51760","TMC51800","TMC61600","TMC63000","TMC64500","TMC64700","TMC94510"]);
else this.getField("AccountCode1").clearItems();

 

Votes

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
Enthusiast ,
Mar 20, 2024 Mar 20, 2024

Copy link to clipboard

Copied

You set items depending on "Site" dropdown, so what exactly is problem if you set same items to all lines?

Votes

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 ,
Mar 22, 2024 Mar 22, 2024

Copy link to clipboard

Copied

LATEST

Each line may be a different Account Code.

Votes

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 ,
Apr 12, 2022 Apr 12, 2022

Copy link to clipboard

Copied

This is fantastic -- worked like a charm! only issue I am having is that once the second dropdown is populated and a selection is made, when the form is submitted it does not get sent to the recieving folder... leaves that section blank. Any idea how this can be fixed? 

Votes

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 ,
Dec 06, 2022 Dec 06, 2022

Copy link to clipboard

Copied

Hi,

Could someone please check the following code, I get error message. Thank you!

 

 

if(event.value == "Byggnad inomhus")
this.getField("Välj typ").setItems(["Avlopp / Vask","Belysning","Brödhylla","Entrematta",Fönster/Skyltfönster","Hyllor butik",Höglager","Kakelvägg","Kassaskåp","Klinkergolv",Köksinredning/Vitvaror","Ljuslådor för AHT frys/kylboxar","Möbler/Stolar","Packbänk","Plastridå","Plexiglaspartier","Påkörningsskyd","Reklam och foliering","Skadedjursbekämpning","Solskyddsgardin","Toaletter","Trappor/Stegar inomhus","Undertaksplattor/Bärverk","Varmvattenberedare","Väggar"]);
this.getField("Välj typ").setItems(["Daggvattenbrunnar","Entregolv","Fasader","Gavelskyltar / Fasadskyltar","Kundvagnar/Kundvagnskorgar","Kundvangsfållar/boxar","Lastbrygga","Lastramp","Non Food skåp","Påkörningsskydd/Pollare","Reklamskyltar på fasaden","Skrapgaller","Solskyddstak/Jalusier utomhus","Trappor/Stegar utomhus","Utomhusbelysning byggnad","Väderskydd lastkaj"]);
else if(event.value == "Dörrar")
this.getField("Välj typ").setItems([" Branddörr","Dörrar","Frysrumsdörr","Ingångsdörrar automatik","Lås/Nycklar","Nattleveranszon avgränsning","Skjutgrind (elektrisk)","Snabbrullport","Taksjutportar"]);
else if(event.value == "IT")
this.getField("Välj typ").setItems(["Hårdvara","Överordnat styrsystem"]);
else if(event.value == "Kylteknik")
this.getField("Välj typ").setItems(["Frys och köttboxar","Frysrum","Frysrumsdörr","Glasdörr","Kylcell Aggregat","Kylcell Takskjutport","Kyldiskar/Mopro"]);else if(event.value == "Säkerhet")
this.getField("Välj typ").setItems(["Brandlarm / Utrymninglarm","Brandpost (inomhus)","Brandpost (utomhus)","Brandsläckare","Larmanläggning","Nödutgångsbelysning","Rökluckor","Varularm","Videoövervakning"]);
else if(event.value == "Säkerhetskontroll")
this.getField("Välj typ").setItems(["Säkerhetskontroll Brandskydd","Säkerhetskontroll Elinstallation","Säkerhetskontroll Statik"]);
else if(event.value == "Tak")
this.getField("Välj typ").setItems(["Hängrännor / Stuprör","Skärmtak","Tak","Takkonstruktion"]);
else if(event.value == "Teknisk anläggning")
this.getField("Välj typ").setItems(["Alldammsugare","Bake off ugn","Balpress";"Balpress","Batteriladdare","Brödpåfyllningsvagn","Brödskärningsmaskin","Diskbänk bröd beredning","Dräneringspump","Elskåp/Säkringar","Eltankställe","Eltruck","F&G och avskrivningsvåg","Frukt & Grönt automat","Handtruck","Inventeringsvåg","Kaffemaskin butik","Kassaspärr","Kassor","Klimatanläggning","Komprimator skruv","Kylaggregat","Kylmedelskylare","Lastbrygga","Luft-värmepump","Pantautomat","Pengavåg","Personhiss","Hiss","Pumpar","Ridåvärmare (Dörrar butiker)","Rulltappa-band","Solcellssystem","Städmaskin/Butiker","Technoport/Entregrind","Tobaksförvaring","UPS/Nödströmsaggregat","Uppvärmning","Varuhiss","Ventilation","Värmeåtervinning"]);
else if(event.value == "Utomhusanläggning")
this.getField("Välj typ").setItems(["Carport","Cykelställ","Flaggor / Flaggstänger","Oljeavskiljare p-yta","Parkering/Körfält/Asfalt","Parkering/Körfält/Marksten","Parkeringsbommar","Parkeringsmarkeringar","Parkeringsyta","Planteringsytor/Gräsmattor","Reklamskyltar fristående","Sophantering","Staket/Stängsel","Stolpbelysning","Stolpskylt","Trafikskyltar parkering"]);
else this.getField("Välj typ").clearItems();

Votes

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 06, 2022 Dec 06, 2022

Copy link to clipboard

Copied

You are missing 'else if'condition after first 'if'.
Missing 3 qoutes in first condition.

You have error here(check red text):
else if(event.value == "Teknisk anläggning")
this.getField("Välj typ").setItems(["Alldammsugare","Bake off ugn","Balpress";"Balpress",

 

Votes

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 ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Thank you, it still does not work. Will you look at it again? I am forever grateful!

 

if(event.value == "Byggnad inomhus")
this.getField("Välj typ").setItems(["Avlopp / Vask","Belysning","Brödhylla","Entrematta",Fönster/Skyltfönster","Hyllor butik",Höglager","Kakelvägg","Kassaskåp","Klinkergolv",Köksinredning/Vitvaror","Ljuslådor för AHT frys/kylboxar","Möbler/Stolar","Packbänk","Plastridå","Plexiglaspartier","Påkörningsskyd","Reklam och foliering","Skadedjursbekämpning","Solskyddsgardin","Toaletter","Trappor/Stegar inomhus","Undertaksplattor/Bärverk","Varmvattenberedare","Väggar"]);
else if(event.value == "Byggnad utomhus")
this.getField("Välj typ").setItems(["Daggvattenbrunnar","Entregolv","Fasader","Gavelskyltar / Fasadskyltar","Kundvagnar/Kundvagnskorgar","Kundvangsfållar/boxar","Lastbrygga","Lastramp","Non Food skåp","Påkörningsskydd/Pollare","Reklamskyltar på fasaden","Skrapgaller","Solskyddstak/Jalusier utomhus","Trappor/Stegar utomhus","Utomhusbelysning byggnad","Väderskydd lastkaj"]);
else if(event.value == "Dörrar")
this.getField("Välj typ").setItems([" Branddörr","Dörrar","Frysrumsdörr","Ingångsdörrar automatik","Lås/Nycklar","Nattleveranszon avgränsning","Skjutgrind (elektrisk)","Snabbrullport","Taksjutportar"]);
else if(event.value == "IT")
this.getField("Välj typ").setItems(["Hårdvara","Överordnat styrsystem"]);
else if(event.value == "Kylteknik")
this.getField("Välj typ").setItems(["Frys och köttboxar","Frysrum","Frysrumsdörr","Glasdörr","Kylcell Aggregat","Kylcell Takskjutport","Kyldiskar/Mopro"]);else if(event.value == "Säkerhet")
this.getField("Välj typ").setItems(["Brandlarm / Utrymninglarm","Brandpost (inomhus)","Brandpost (utomhus)","Brandsläckare","Larmanläggning","Nödutgångsbelysning","Rökluckor","Varularm","Videoövervakning"]);
else if(event.value == "Säkerhetskontroll")
this.getField("Välj typ").setItems(["Säkerhetskontroll Brandskydd","Säkerhetskontroll Elinstallation","Säkerhetskontroll Statik"]);
else if(event.value == "Tak")
this.getField("Välj typ").setItems(["Hängrännor / Stuprör","Skärmtak","Tak","Takkonstruktion"]);
else if(event.value == "Teknisk anläggning")
this.getField("Välj typ").setItems(["Alldammsugare","Bake off ugn","Balpress","Batteriladdare","Brödpåfyllningsvagn","Brödskärningsmaskin","Diskbänk bröd beredning","Dräneringspump","Elskåp/Säkringar","Eltankställe","Eltruck","F&G och avskrivningsvåg","Frukt & Grönt automat","Handtruck","Inventeringsvåg","Kaffemaskin butik","Kassaspärr","Kassor","Klimatanläggning","Komprimator skruv","Kylaggregat","Kylmedelskylare","Lastbrygga","Luft-värmepump","Pantautomat","Pengavåg","Personhiss","Hiss","Pumpar","Ridåvärmare (Dörrar butiker)","Rulltappa-band","Solcellssystem","Städmaskin/Butiker","Technoport/Entregrind","Tobaksförvaring","UPS/Nödströmsaggregat","Uppvärmning","Varuhiss","Ventilation","Värmeåtervinning"]);
else if(event.value == "Utomhusanläggning")
this.getField("Välj typ").setItems(["Carport","Cykelställ","Flaggor / Flaggstänger","Oljeavskiljare p-yta","Parkering/Körfält/Asfalt","Parkering/Körfält/Marksten","Parkeringsbommar","Parkeringsmarkeringar","Parkeringsyta","Planteringsytor/Gräsmattor","Reklamskyltar fristående","Sophantering","Staket/Stängsel","Stolpbelysning","Stolpskylt","Trafikskyltar parkering"]);
else this.getField("Välj typ").clearItems();

Votes

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 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

You didn't add quotes in first condition, try now:

 

if(event.value == "Byggnad inomhus")
this.getField("Välj typ").setItems(["Avlopp / Vask","Belysning","Brödhylla","Entrematta","Fönster/Skyltfönster","Hyllor butik","Höglager","Kakelvägg","Kassaskåp","Klinkergolv","Köksinredning/Vitvaror","Ljuslådor för AHT frys/kylboxar","Möbler/Stolar","Packbänk","Plastridå","Plexiglaspartier","Påkörningsskyd","Reklam och foliering","Skadedjursbekämpning","Solskyddsgardin","Toaletter","Trappor/Stegar inomhus","Undertaksplattor/Bärverk","Varmvattenberedare","Väggar"]);
else if(event.value == "Byggnad utomhus")
this.getField("Välj typ").setItems(["Daggvattenbrunnar","Entregolv","Fasader","Gavelskyltar / Fasadskyltar","Kundvagnar/Kundvagnskorgar","Kundvangsfållar/boxar","Lastbrygga","Lastramp","Non Food skåp","Påkörningsskydd/Pollare","Reklamskyltar på fasaden","Skrapgaller","Solskyddstak/Jalusier utomhus","Trappor/Stegar utomhus","Utomhusbelysning byggnad","Väderskydd lastkaj"]);
else if(event.value == "Dörrar")
this.getField("Välj typ").setItems([" Branddörr","Dörrar","Frysrumsdörr","Ingångsdörrar automatik","Lås/Nycklar","Nattleveranszon avgränsning","Skjutgrind (elektrisk)","Snabbrullport","Taksjutportar"]);
else if(event.value == "IT")
this.getField("Välj typ").setItems(["Hårdvara","Överordnat styrsystem"]);
else if(event.value == "Kylteknik")
this.getField("Välj typ").setItems(["Frys och köttboxar","Frysrum","Frysrumsdörr","Glasdörr","Kylcell Aggregat","Kylcell Takskjutport","Kyldiskar/Mopro"]);else if(event.value == "Säkerhet")
this.getField("Välj typ").setItems(["Brandlarm / Utrymninglarm","Brandpost (inomhus)","Brandpost (utomhus)","Brandsläckare","Larmanläggning","Nödutgångsbelysning","Rökluckor","Varularm","Videoövervakning"]);
else if(event.value == "Säkerhetskontroll")
this.getField("Välj typ").setItems(["Säkerhetskontroll Brandskydd","Säkerhetskontroll Elinstallation","Säkerhetskontroll Statik"]);
else if(event.value == "Tak")
this.getField("Välj typ").setItems(["Hängrännor / Stuprör","Skärmtak","Tak","Takkonstruktion"]);
else if(event.value == "Teknisk anläggning")
this.getField("Välj typ").setItems(["Alldammsugare","Bake off ugn","Balpress","Batteriladdare","Brödpåfyllningsvagn","Brödskärningsmaskin","Diskbänk bröd beredning","Dräneringspump","Elskåp/Säkringar","Eltankställe","Eltruck","F&G och avskrivningsvåg","Frukt & Grönt automat","Handtruck","Inventeringsvåg","Kaffemaskin butik","Kassaspärr","Kassor","Klimatanläggning","Komprimator skruv","Kylaggregat","Kylmedelskylare","Lastbrygga","Luft-värmepump","Pantautomat","Pengavåg","Personhiss","Hiss","Pumpar","Ridåvärmare (Dörrar butiker)","Rulltappa-band","Solcellssystem","Städmaskin/Butiker","Technoport/Entregrind","Tobaksförvaring","UPS/Nödströmsaggregat","Uppvärmning","Varuhiss","Ventilation","Värmeåtervinning"]);
else if(event.value == "Utomhusanläggning")
this.getField("Välj typ").setItems(["Carport","Cykelställ","Flaggor / Flaggstänger","Oljeavskiljare p-yta","Parkering/Körfält/Asfalt","Parkering/Körfält/Marksten","Parkeringsbommar","Parkeringsmarkeringar","Parkeringsyta","Planteringsytor/Gräsmattor","Reklamskyltar fristående","Sophantering","Staket/Stängsel","Stolpbelysning","Stolpskylt","Trafikskyltar parkering"]);
else this.getField("Välj typ").clearItems();

Votes

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 ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

It works now! Thank you so so so much!!!!!

Votes

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 ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

Is it possible to affect multiple drop down lists from the value selected in the first list?

List 1 - select the value that affects the other lists

List 2 - correctly affected

List 3 - nothing happens with the code below

 

if(event.value == "Training")
this.getField("Earning1.0.0","Earning1.0.1").setItems(["Training-OTJ","Training-Platform"]);
else if(event.value == "Mortgage")
this.getField("Earning1.0.0","Earning1.0.1").setItems(["Commissions","Referral Fees-Mortgage"]);
else this.getField("Earning1.0.0","Earning1.0.1").clearItems();

Votes

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 ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

Use this:

if(event.value == "Training"){
this.getField("Earning1.0.0").setItems(["Training-OTJ","Training-Platform"]);
this.getField("Earning1.0.1").setItems(["Training-OTJ","Training-Platform"]);}
else if(event.value == "Mortgage"){
this.getField("Earning1.0.0").setItems(["Commissions","Referral Fees-Mortgage"]);
this.getField("Earning1.0.1").setItems(["Commissions","Referral Fees-Mortgage"]);}
else{
this.getField("Earning1.0.0").clearItems();
this.getField("Earning1.0.1").clearItems();}

Votes

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 ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

You are a genius! That was my first time posting on this forum for help and I did not expect an answer so quickly. I can't thank you enough. This was my first time using JavaScript.

Votes

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 ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Hello, 

I am folowing this discussion and thank you for providing solutions. I too have 2 Dropdown lists and based on the choice from the first list, I am trying to set the items (numbers 1-10 or 1-25 or 1-12 etc.). When I tab after selecting the item from first DD1, the second DD2 is populated with the range for previous DD1 choice. I have used the clearItems() as suggested above. How do I clear and reset the correct range for the choice in DD1?

 

Any help is appreciated. Thank you.

Votes

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