1

i have custom fields like this:

"country" - values: "USA", "Russia", "China" "city" - values: "Chicago", "Moscow", "Beijing" I want when user in custom field "country" choose value "USA" after that in custom field "city" show only "chicago". Is it possible? And how can I do this?

is there wordpress plugin that does this?

0

No plugins. You'll have to build it yourself, using a JavaScript library.

Basically, you'll need to use an onchange() event on the main dropdown, then get the value and check an array of values for that specific value.

If you search for a library, look for "chained select" or "linked select".

Another solution would be to have all the dropdowns on the page, hidden, and then, based on your selection, show the one that corresponds to your selection.

Note: I can't give you a proper solution as it depends on how your values are being read (manually, from array, or from the WordPress database) and it's opinion based.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.