ACF Flexible Content

I’m using ACF options to output to a select field on the front end. This is pretty trivial with a repeater and it works great. However, it gets a bit more complicated using a flexible content that includes a repeater.

I can loop through the flexible field but i’m running into an issue when i try to pull the fields from the repeater and it doesn’t seem like I can nest loops.

Still getting use to Loops and Logic!

<select onchange="location = this.value;">
    <option value="#">Select Online Applications</option>
    <Loop acf_flexible=onl_app_option_fc from=options>
        <optgroup label="{Field option_group_label}">
            <Loop acf_repeater=options>
                <option value="{Field online_app_option_value}"><Field online_app_option_label /></option>
            </Loop>
        </optgroup>
    </Loop>
</select>

I see, this is an interesting situation: flexible content field from options, and then a repeater field inside… I believe this hasn’t been tested yet, and it sounds like the inner loop for repeater is not working correctly.

OK, we’ll look into this and let you know!


In the meantime, perhaps you could try putting from=options on the inner loop?

@eliot from=options didn’t fix the inner repeater loop.

I appreciate the help!

@eliot Curious if you’ve discovered a solution?

Hi @patrickgeustis - Please try the newly released version 2.0.2, which now has proper support for nested repeater and flexible content fields, including from options. The attribute from=options is only necessary for the top level field.

Sorry it took us a while to get this released, there were some new features (like import/export templates) and internal changes that needed to be tested.

2 Likes

@eliot updating now, I appreciate it!