Home › Forums › Add-ons › Repeater Field › Dynamically populate repeater select subfields per row › Reply To: Dynamically populate repeater select subfields per row
John,
thank you for your help, I’ve been visiting the forums often and your posts have been very helpful to me so far.
I realize that the problem derives from the fact that each repeater subfield can only have a specific set of choices, but I wonder why – hopefully the plugin is extended to support this.. at least target something.
The function you are describing would be great, as long as I can target what you describe as {DYNAMIC SELECT FIELD NAME}
. How do you target this?
Other than that, populating the field like this is not causing any issues with non-repeater fields, so it might not be a problem here either.
The way I am using to populate the select field (in non-repeater fields) so it includes the necessary choices, is something like you proposed.. I use a $_GET variable with the post_id and using this I retrieve the manufacturer selection; after that I populate using the prepare_field and the json file – so, when the field is rendered, it already includes the saved model in its choices.
For the repeater field the closest I can get to is to use the post_id and loop all selected manufacturers and create a choice-list that includes the sum of all manufacturers… which is not what I want.
The alternative is simply to run a JS function and populate all select fields individually, but this happens client-side and is somewhat heavy.
So essentially the question is… how can I target individually a select field at a specific repeater row using something like what you proposed – {DYNAMIC SELECT FIELD NAME}
?
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.