Home Forums Add-ons Repeater Field Dynamic select data in repeater's field


Dynamic select data in repeater's field

    • Greg25

    • May 15, 2020 at 12:58 am

    I have a repeater field that has 2 select sub-fields and I want to dynamically populate both. The second sub-field choices change depending on what is selected in first sub-field – second select choices could be different for each row.

    So far I got dynamic values initialized for both selects, passed localization data used to change second select via JS.

    When I save post, values are saved correctly but the select fields all reset to initial choices.

    Before save:
    Row1: A – 1, (2), 3
    Row2: A – 1, 2, (3)
    Row3: B – a, b, (c)

    After save:
    Row1: A – 1, (2), 3
    Row2: A – 1, 2, (3)
    Row3: A – (1), 2, 3

    By now I presume you just can’t modify data of fields in individual rows, but please tell me I missed something 🙂


    You might be able to prevent prevent ACF from resetting the values by using an acf prepare field filter. I think this is called for each value. You can get the current value and make sure that it is available as a choice and this should (I think) prevent the value being reset.

    • Greg25

    • May 19, 2020 at 9:19 pm

    Thank you so very much! That one indeed fires for every single repeater field. I got the value from first select field, based on that fetched my options and filled them as choices in the second select field 😀

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.