Copy link to clipboard
Copied
Hi there,
I am trying to make a selection from one drop-down list (Service) that populates different items in the second drop-down list (Units of measure).
I found another similar question in the community but when I use the code (I am not a coder) I keep getting the following error- syntaxError: unterminated string literal 4: at line 5.
Here is the code:
if(event.value == "Storage")
this.getField("Unit of measure 2.0.12.1").setItems(["Per Standard* Pallet","Per Non-Standard Pallet","Per Bin","Per Square Foot"]);
else if(event.value == "IN Handling")
this.getField("Unit of measure 2.0.12.1").setItems(["Per Pallet 'IN'","Per Carton 'IN'","]);
else this.getField("Unit of measure 2.0.12.1").clearItems();
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();
This is not the complete drop-down as I wanted to try it first. Also, I am guessing this would go in the first dropdown field? I would really appreciate some help!
You have an extra quotation mark, remove red part:
this.getField("Unit of measure 2.0.12.1").setItems(["Per Pallet 'IN'","Per Carton 'IN'","]);
Copy link to clipboard
Copied
As the error message says, you have an unterminated string in your code, specifically in the last item in the array in this line:
this.getField("Unit of measure 2.0.12.1").setItems(["Per Pallet 'IN'","Per Carton 'IN'","]);
And yes, this code should be used as the custom validation script of the first drop-down.
Copy link to clipboard
Copied
Thank you so much for offering your help.
I guess I am asking how to fix this? How do I terminate it? What is the code I need to make it work? I don't see any open square parenthesis.
Copy link to clipboard
Copied
You have an extra quotation mark, remove red part:
this.getField("Unit of measure 2.0.12.1").setItems(["Per Pallet 'IN'","Per Carton 'IN'","]);
Copy link to clipboard
Copied
Thank you so much! I've been staring at this forever trying to figure out where I went wrong. I am so relieved.