NO BUG: Dynamic data in Bricks Form Checkbox Field

Hi, Bricks is not outputting ACF dynamic data in my form Checkboxes.

It has a dynamic data icon, so I assume it should be able to output dynamic data. Is this a bug?

Hi Simon,
Thanks so much for your report!

What type of ACF field is it?

Best regards,
timmse

Thanks @timmse, it’s a checkbox field.

Please check if the page has any checked options - in case you changed the choices or the return type, a re-select/re-save is needed.

However, you’ll probably get one option as a comma-separated list and not separate options.
But there’s a filter that seems to work. Just change the tag name to the dd tag name you’re using (acf_incident_type):

<?php
add_filter(
    'bricks/dynamic_data/text_separator',
    function ($sep, $tag, $post_id, $filters) {
        // Change to whtever tag name is used
        if ($tag === 'acf_acf_checkbox') {
            return "\n";
        }
        return $sep;
    },
    10,
    4
);

Thanks very much, I will give it a try and report back.

Hi @timmse I have added that code to functions.php, replacing the tag with the correct tag name. But the output is still blank as before.

Am I executing the code in the wrong way?

I have no idea what you’re doing :slight_smile:
Please send temporary login credentials, information on where we have to look, and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase.

Thanks for the login credentials!

It’s basically what I already assumed:

The contact page doesn’t have the checkbox field, so there’s nothing to check and, therefore, no data to display. The field is assigned to the incident post type, so you can’t use it on the contact page.

That’s not a Bricks bug, but how ACF (or any other custom field provider) works :v:

Stefan I was baffled by your reply, but eventually the ‘penny dropped’.

To anyone else as dumb as me, here it is explained in a different way…

I didn’t understand @timmse comment…

Please check if the page has any checked options

The ACF options were not appearing in the Bricks form because, those ACF options show on the edit page of Posts, not the edit page of the Contact Us page (Gutenberg).

So, in ACF I changed the conditions of the Field Group to, not only show on Post edit pages, but also on the Contact Us edit page.

I then went to the Contact Us edit page and ticked all the the ACF options.

Voila! They now appear in the form as checkbox options. (no need for the additional code it seems).

The more you begin to understand, the more obvious it becomes.

I was expecting Bricks to fetch the options from ACF admin area. But that’s not how it works. Bricks looks to the page you are editing for any ACF fields that have been completed.

It would be interesting to know if there was some way of pulling those options dynamically directly from ACF admin.

But for now thanks for helping me get there @timmse .

Hey Simon,
Sorry if I didn’t express myself clearly enough. But I’m glad that you understood what I wanted to say in the end :slight_smile:

1 Like