Dependent Dropdown does not save selection
- October 5, 2020
- 2 replies
- 2599 views
I have a dependent dropdown that does not save your selection after you save the form and reopen it. I'm not sure it's in an error with the code for this drop down or if the list before it is preventing it from saving. Form is attached but general functionality is:
Dropdown 1 Selection (Carrier)
Dropdown 2 (Product) - items dependent upon selction in Dropdown 1
Text Fields - text fields appear based on the selection in dropdown 2.
(Carrer) Dropdown 1 has code in Format Tab, Custom, Custom Format Script
(Product) Dropdown 2 has code in Format Tab, Cusom, Custom Format Script
I tried moving both codes to Custom Calculation Script but then Dropdown 2 doesn't change list items based on Dropdown 1 selection.
I'm at a loss! Thank you! Form attached in case anyone wants to take a look.
Carrier dropdown code: (this is from a sample form I found so I very well could have done it wrong)
dependentListBoxFieldName = "dependentDropdown";
var dependentListValues =
{
"AIG": [
["Product"],
["Platinum Choice VUL 2", "Platinum Choice VUL 2"],
["Secure LifeTime GUL 3", "Secure LifeTime GUL 3"],
["Select-A-Term", "Select-A-Term"]
],
"John Hancock": [
["Product"],
["Protection VUL 17"],
["Protection UL 19"],
["Protection Term"]
],
"Lincoln": [
["Product"],
["VULOne", "VULOne"],
["SVULOne", "SVULOne"],
],
"Pacific Life": [
["Product"],
["Harbor VUL", "Harbor VUL"],
["Promise GUL"],
],
"Protective Life": [
["Product"],
["Strategic Objectives VUL"],
["Advantage Choice UL"],
["Classic Choice Term"],
],
"Prudential": [
["Product"],
["VUL Protector"],
["PruLife Custom Premiere"],
["Term Essential"],
]
};
/*
You probably don't need to change anything from here down
*/
if ((event.target.type == "combobox" && event.name == "Format") || (event.target.type == "listbox" && event.name == "Keystroke")) {
if (event.target.type == "combobox") {
if (dependentListValues.hasOwnProperty(event.target.value)) {
this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.target.value]);
}
else {
this.getField(dependentListBoxFieldName).clearItems();
}
}
if (event.target.type == "listbox" && dependentListValues.hasOwnProperty(event.changeEx)) {
this.getField(dependentListBoxFieldName).setItems(dependentListValues[event.changeEx]);
}
}
Product dropdown code (it's really long so this is just a snippet of what I have)
if (this.getField("dependentDropdown").value=="Platinum Choice VUL 2") {
this.getField("AIGProspectus").display=display.visible;
}
if (this.getField("dependentDropdown").value=="Protection VUL 17") {
this.getField("AIGProspectus").display=display.hidden;
}
if (this.getField("dependentDropdown").value=="VULOne") {
this.getField("AIGProspectus").display=display.hidden;
}
if (this.getField("dependentDropdown").value=="SVULOne") {
this.getField("AIGProspectus").display=display.hidden;
}
if (this.getField("dependentDropdown").value=="Harbor VUL") {
this.getField("AIGProspectus").display=display.hidden;
}
if (this.getField("dependentDropdown").value=="VUL Protector") {
this.getField("AIGProspectus").display=display.hidden;
}
if (this.getField("dependentDropdown").value=="Strategic Objectives VUL") {
this.getField("AIGProspectus").display=display.hidden;
}
