Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Multiple instances of dynamic dropdown don't populate

Avatar

Level 2

Hello all,

I have a dropdown (called ContractDescription) whose contents are dynamically populated based on the selection the user makes in ANOTHER dropdown (Called PlanType).  ContractDescription is stored in a row called EnrollmentInfo.

ContractDescription has an "Add Line" functionality where the click of a button will bring up another instance of EnrollmentInfo (the row).  The first instance of this row (which always shows up) populates the dropdown info just fine, however, each additional instance only shows up blank when I click in the dropdown.

Below is the code that I currently have in the initialize event of ContractDescription:

var

Length = EnrollmentSubform.EnrollmentTable.EnrollmentInfo.instanceManager.count;

var

i = 0;

for

(i = 0; i < Length; i++){

switch(PlanProfileSubform.PlanType.rawValue){

case "06 - NonQualified Deferred Compensation":

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "Institutionally Owned Modified Group Annuity";

break;

case "07 - 457(f)":

if(InvestmentsAllocationsSubform.AddFundsSubform.TIAAStableValueAnnuity.rawValue == 1){

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "Institutionally Owned Modified Group Annuity";

}

else{

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "Institutionally Owned GSRA";

}

break;

case "10 - 457(b) Public":

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("GSRA Contact");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Choice Plus Contract");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "";

break;

case "14 - 415(m)":

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "Institutionally Owned GSRA";

break;

case "17 - 457(b) Private":

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "Institutionally Owned Modified Group Annuity";

break;

default:

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.clearItems();

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("457(b) Private - Institutionally Owned Modified Group Annuity");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("GRA Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("GSRA Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("RA Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("RA QVEC Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Choice (84)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Choice (60)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Choice (5)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Choice Plus Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Large");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Plus Mid");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Plus Direct");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Plus II Large");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Plus II Mid");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Retirement Select Plus II Direct");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("SRA Contracts");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("457(f) - Institutionally Owned GSRA");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Group Annuity (GRA Rates)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Group Annuity (GSRA Rates)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.addItem("Group Annuity (RA Rates)");

EnrollmentSubform.EnrollmentTable.EnrollmentInfo[i].ContractDescription.rawValue

= "";

break;

}

}

Can anyone tell me why this isn't working?

1 Reply

Avatar

Level 6

I can point to two things based on your description and the JS code....

As you are using initialize event for populating ContractDescription I do not see need for using for loop. Then your situation simplifies down to that particular DD than messing up with all other DDs....there by suing "this" reference would workout well rather than printing SOMExpression each time.

Also noticed some times you used CleanItems() then in the very next statement you are setting .rawValue ="......". I guess you need to use .addItem() then set the value.

Try these and email (n_varma(AT)lycos.com) me copy of the template if you still have trouble fixing.

Good Luck,