Home › Forums › General Issues › insert value of a custom field, based on another custom field › Reply To: insert value of a custom field, based on another custom field
I have an example of doing this with a relationship field, unfortunately, it has not been updated to work with the new ACF JS API and will not work in the current version of ACF.
What you have to do is to add an action on the relationship/post object field that triggers an AJAX request to get and populate the values in the other fields. As I said, this old example will not work, but it covers the basics https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-fields-on-relationship
This example has been updated to work with the current version of ACF and shows the differences from the old code to the new code when it comes to making the AJAX request https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example
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.