Home › Forums › ACF PRO › Populate drop-down from another drop-down › Reply To: Populate drop-down from another drop-down
Doing this will be fairly complicated. I do not know of any examples for doing this exactly but there are some examples of other cases available of the web if you do a google search for acf populate seclect field based on another field
I can give you a rough outline of what you need to do.
The first step will be to use an acf/prepare_field filter to dynamically populate the choices for the second select field based on the first field. This is necessary so that if there is a currently selected value that this value is include in the available choices. Without this step the selected choice will be un-selected when the page is reloaded.
The second thing you will need to do is add custom JavaScript to ACF. Your script will need to have a action that fires when the first field is changed and update the available options in the second field.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.