Skip to main content
Participating Frequently
April 24, 2024
Answered

The dropdown list doesn't display the other dropdown values

  • April 24, 2024
  • 1 reply
  • 662 views

Please I'm new with JavaScript and I need your help with this :

I've created 7 dropdown lists: "Product", "StoreA", "StoreB", "StoreC", "StoreD", "StoreE" and "DeliveryTime".

Each dropdown list has the following values :

- "Product" : "Select an item", "Item 1", "Item 2", "Item 3" and "Item 4"

- "StoreA" : " "

- "StoreB" : "Store 1"

- "StoreC" : "Store 2"

- "StoreD" : "Store 3", "Store 4"

- "StoreE" : "Store 5"

The  "StoreA", "StoreB", "StoreC", "StoreD", and "StoreE" are visible/hide based on a value from the "Product" dropdown list. I made a javascript code adequate in a custom validation script and it works pefectly!

My issue is with the "DeliveryTime", I want it to be populated based on the dropdown list visiblity  :

- if "StoreA" is visible then "DeliveryTime" = " "

- if "StoreB" is visible then "DeliveryTime" = "5 days"

- if "StoreC" is visible then "DeliveryTime" = "6 days"

- if "StoreD" is visible : with the value "Store 3" the "DeliveryTime" = "3 days or 7 days", and with the value "Store 4" the "DeliveryTime" =  "4 days"

- if "StoreE" is visible then "DeliveryTime" = "3 days or 7 days"

but the code that I made for this doesn't work. the file is in the attachment and sorry to be so long-winded

This topic has been closed for replies.
Correct answer Nesa Nurani

Validate script is triggered when value of the field changes, making the field visible/hidden doesn't trigger validation script, so use the script for delivery in the field where you trigger Store fields visibility.

 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
April 24, 2024

Validate script is triggered when value of the field changes, making the field visible/hidden doesn't trigger validation script, so use the script for delivery in the field where you trigger Store fields visibility.

 

RsTm16Author
Participating Frequently
April 24, 2024

Thank you so much for all these clarifications, it works! and I've learnt something new today 🙂