Copy link to clipboard
Copied
I've created a dropdown menu named "Product" with 3 items in this order : "item1", "item2" and "item3".
Wondering if someone can help me with the javascript code that will allow "item2" to be selected.
Thanks
Copy link to clipboard
Copied
JavaScript is case sensitive, it's not "item2" it's "Item 2" including space, and it's not "Type2" it's "Type 2", you need to be very specific, try this:
if(event.value == "Item 2")
this.getField("Type").value = "Type 2";
Copy link to clipboard
Copied
Here you go:
this.getField("Product").value = "item2";
Copy link to clipboard
Copied
Thank you for reply, unfortunaltely it didn't work.
FYI, I've created 2 dropdown menu: "Type" and "Product"
- "Type" has 3 items : "Type1" , "Type2" and "Type3"
- "Product" has 3 items : "item1", "item2" and "item3"
I need a javascript code to set the dropdown "Type" value to "Type2" when the "item2" is selceted in "Product".
Copy link to clipboard
Copied
You should explain like that in the first post 🙂
Use this as 'Validate' script of "Product" field:
if(event.value == "item2")
this.getField("Type").value = "Type2";
Copy link to clipboard
Copied
Still not working 😞 please check the file in the attchement
Copy link to clipboard
Copied
JavaScript is case sensitive, it's not "item2" it's "Item 2" including space, and it's not "Type2" it's "Type 2", you need to be very specific, try this:
if(event.value == "Item 2")
this.getField("Type").value = "Type 2";
Copy link to clipboard
Copied
it works! thank you for your assitance

