Error in ACF repeater > select field label

I put an ACF repeater field in a post which included 5 sub fields:

  1. a select field : yes / no
  2. a relational user field to link some WP users in my post
  3. another select field : red / blue
  4. an datepicker field
  5. a standard textarea field

I have an error if I use this syntax :

<Loop acf_repeater=my_acf_repeater_field>
    <li>
      <span class="meta">
        <Field acf_select=field_name1 field=label />
        <Loop acf_user="field_name2"><Field full_name /></Loop>
        <Field acf_select=field_name3 field=label />
        <Field acf_date=field_name4 />
      </span>
      <span><Field field_name5 /></em></span> 
    </li>
<If last><Else /><hr></If>
  </Loop>

When I have 2 rows or more in my repeater field, the first <Field acf_select=field_name1 field=label /> is mysteriously missing.

I used another syntax to fix this but it seems curious. Here is the one that works but I cannot choose if I want to display the value or the label in my select field :

<Loop acf_repeater=my_acf_repeater_field>
    <li>
      <span class="meta">
        <Field field_name1 />
        <Loop acf_user="field_name2"><Field full_name /></Loop>
        <Field field_name3 />
        <Field acf_date=field_name4 />
      </span>
      <span><Field field_name5 /></em></span> 
    </li>
<If last><Else /><hr></If>
  </Loop>

How is that possible ?

Hi Guillaume, I just tested out this functionality myself and it all seems to be working correctly. On a just-about-blank WordPress install, I’ve got a select field inside a repeater field:

I then have a very simple template quite similar to yours where I’m looping through my repeater and displaying the field label for my select field:

<p>Here are the results from my repeater loop:</p>

<Loop acf_repeater=my_repeater_field>
  <p><strong>Repeater row <Get loop=count /></strong></p>
  <ul>
    <li><Field acf_select=repeater_select_field field=label /></li>
    <li><Field repeater_text_field /></li>
  </ul>
</Loop>

And it’s displaying data as I’d expect:

Since this doesn’t seem to be an issue with the basic functionality of Loops & Logic, there must be something else that’s causing this issue for you. Some things you could try:

  • Checking whether anything changes if you modify your field settings in ACF.
  • Checking whether you’re able to display the labels using any of the other syntax options available in L&L, such as:
<Loop acf_select=field_name field=labels>
  Label: <Field />
</Loop>

or

<Loop acf_select=field_name field=choices>
  Label: <Field label /><br/>
</Loop>
  • Creating a fresh WordPress install with a similar data structure to see if the issue arises there.
  • Testing to see if a plugin conflict is causing things to behave differently on your site
  • Verifying how the L&L template is being displayed on the page. If you’re using any third-party plugins to render the template on your page, try displaying the template on a page using the [template] shortcode or the native Tangible Template block in your builder.

If you’re able to identify what unique part of your WP configuration is causing this issue that doesn’t seem to be affecting things on my fresh install, let me know and I’ll try to replicate it so that we have something to pass on to the devs. Let me know if you have any other information that would help us replicate this!

Hi Benjamin, thanks for your reply.
Please find below a new test result that show up the issue :


Actually, I think the bug appears when the same option is selected in the both repeater rows for the same field. Here “renvoi” choice label in “instruction_decision” ACF select field.

Can you make another test on you side with this setup please ?
thanks

Tested again while setting all the select field values to the same thing in my repeater. Still worked as expected on my end and displayed all the results. Let me know if you get a chance to try any of the suggestions from the post above :slight_smile:

OK I found where the error comes from :smiley: I confirm : this is not due to Tangible plugin and the acf_select syntax of Tangible is right.

To put in a nutshell, my ACF select field values comes from Gravity Form entries. At each form submission, I automatically create a new row in my ACF repeater and fill the subfields with the GF entry value. But the format between the Gravity Form select field and the ACF one are not exactly the same. The data is correctly stored in database but not using the ACF parameters of my select field. That’s why <Field custom_field /> syntax works but not the <Field acf_select=custom_field field=label />. The acf_select syntax works only when I set the value of my ACF select fields trough Wordpress post admin page.

I will investigate but this is on my side ! Thanks again for the support.

1 Like