Home › Forums › Add-ons › Repeater Field › Using acf/load_field/key=field_#######
This is complicated (in my eyes at least).
Latest version of ACF Pro, Latest WP.
I am using a repeater to display a select list of dynamic values that controls the second select in the same row which also loads dynamic values based on the first selection.
The issue is that using acf/load_field/key=### is that it changes all the fields and not just the one. So I’ve overcome that with JS by selecting the specific field on change and finding its parent ID and then updating the values of the next select.
The issue is that when I come back to the page to edit again, the field is empty again.
-repeater
— select1 (loaded from JSON result)
— select2 (once select1 is changed, this loads from another JSON file. results populate DB as they should.)
Once I go back to the page, select2 is empty again. I need to be able to load it BASED on the value of select1 but I cant seem to get the repeater index from within the function as it only uses the $field object.
Help? Also email me if you can help but need more details.
I should probably also mention that I don’t have anything set in the select options in ACF at all because it’s all coming from the JSON files.
And the –select2 options all come from different JSON endpoints in another application.
Any help here?
I’ve a similar requirement but I’cant figure out how to pass first select value to ‘acf/load_field’ for the second value.
Regards.
César
Hi,
I’ve solved a similar problem with this example: https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example
Hope it helps,
Regards
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.