Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Dynamic Dropdown Help

Avatar

Level 1

I've watched countless videos and read many posts on how to create dropdowns but the script I'm writing is still not working. I'm trying to create something pretty basic. I have two dropdowns on two different pages. The value of the dropdown on the first page will decide what shows up on the dropdown on the other page. I've specified item values for both lists. Any help would be greatly appreciated. Thanks in advance. So far, the code i've created is this:

switch(this.rawValue){

case "1":

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem("Primary-insured
or staff 24/7");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("70%-working couple");

   break;

case "2":

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem ("Primary-insured or staff 24/7");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("70%-working couple");

    break;

case "3":

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied 3-6 months/year");

ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied more than 6 months/year");

    break;

case "4":

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied 3-6 months/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied more than 6 months/year");

    break;

case "5":

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied 3-6 months/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied more than 6 months/year");

    break;

case "6"

ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied 3-6 months/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied more than 6 months/year");

     break;

case "7"

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied 3-6 months/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
("Unoccupied more than 6 months/year");

   break;

default:

    OccupancyDropDown.addItem("Please choose
Occupancy");

    break;

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi, in your code you are only missing 2 small things... -> ":"

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi, in your code you are only missing 2 small things... -> ":"

Avatar

Level 1

Thank you for the response, that solved the error message but did not make the dynamic dropdown work. Do you have any other ideas as to why this may be happening?

Avatar

Level 10

I am not absolutely sure, but when you are adding an item in the dropdownlist, fill in the 2nd property in the addItem method...

You would only have to write it like this:

if this is not working there must be an error somewhere... maybe in your reference_syntax or something... also make sure to be in the exit event of the first dropdownlist