Home › Forums › General Issues › Dynamically populate a field from another field
Hopefully a simple request –
I have a need to allow a user to:
1 – select an item from a dropdown list, and
2 – have another field populated with information based on the original selection.
For example – it the user chooses “ABC” from the first drop down, I need the second field to reflect “Aaron Bob Charlie”
Any assistance will be greatly appreciated.
Hi John – thanks for the swift response.
My intent is to create a separate field where that data would be entered (as it may change frequently and it needs to be referenced for other purposes).
JM
I’m still not understanding what it is you’re trying to do. Can you supply more detail.
Hi John – I apologize for the delay in responding to you.
My intent is as follows:
Dropdown Field One –
Will contain acronyms such as
“One”
“Two”
“Three”
etc.
Dropdown Field Two –
Will contain matching full descriptions such as
“Item One”
“Item Two”
“Item Three”
etc.
Each of the items in Field One and Field Two will correlate one-on-one directly to the other. I am choosing two separate fields because the data in each field will have specific uses in forms we generate. (for example, in one part we will populate only the acronym, and in another the full descriptions)
What I am attempting to find is a solution where if the User chooses an Item from Dropdown Field One and it will automatically populate Field Two.
Is this more helpful?
JM
You need to use JavaScript and AJAX to populate the second field. This example populates a select field based on another select field. It’s probably not exactly what you are looking for but it show the basics. https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example
Thanks John –
I really appreciate your attempt to help here. Regrettably this is SO far above my head that although I’m sure it’s helpful to most, it is all foreign to me. Guess we’ll look at other avenues/products.
You must be logged in to reply to this topic.
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.