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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.