Support

Account

Home Forums Add-ons Repeater Field Default values not working when using clone fields within repeater field

Solved

Default values not working when using clone fields within repeater field

  • I’m having problems getting the default values to work when using multiple Clone fields within a Flexible Content field.

    I’ve attached my field groups. There’s a “Flexible Panels” group, which has a single Flexible Content field, with multiple layouts within it. Each layout has their own unique fields, but adds the “Flexible Panels Options” field group as a clone.

    I have to use the “seamless” option, since I want to use tabs to separate the unique layout fields from the panel options.

    The fields work fine, except that when adding a new layout (panel), the default values are never selected. The exception being for the last layout, where the values do show up. If I only have the clone fields on the first layout, it works there. If I have the clone field on the first and second layouts, the first layout doesn’t show default values, but the second does. And so on.

    As far as I know, I shouldn’t have to use Prefix Field Names (especially with the seamless option), but I could be wrong.

    Is there something I’m doing wrong, or is it a bug?

    Thanks to anyone who can help.

    PS. The new clone field is absolutely amazing, it’s saving me so much work, I love it!!!

  • I just did a test with your field groups. I imported the groups into a site with only ACF installed and using and unmodified version of Twenty Fifteen. Everything seems to be working.

    You say that the defaults are not selected when you add an new layout. The layout is added using JavaScript, so there may be an error happening in JS that’s causing the issue. Check to see if you see any JS errors.

    There have been some reports of JS issues that started in WP 4.6. This has been reported to the developer and should be fixed in the next update. What version of WP are you using? What version of ACF do you have installed?

    Try deactivating other plugins or switch to one of the default WP themes. Let me know if any of this corrects the problem.

  • I’m running WP 4.6 and ACF PRO 5.4.2, the latest versions as of right now. I setup a fresh WP install with no plugins except ACF, and running the default Twenty Sixteen theme. No JS errors, but the default values still weren’t select (except for the last panel type, “Plain Code”, which does work for some reason).

    If you got it to work, there must be something wrong on my end that I’m not seeing. I’m going to keep trying a few things and report back if I find a solution.

  • Or it could be that I’m not understanding. You are talking about the values under the “Panel Options” tab in each layout. When I add a new layout the values Top Spacing == Medium and Bottom Spacing == Medium are set. I also have no other groups set for the default template on pages.

    If you have no other plugins but ACF and you’re and an unmodified version on Twenty Sixteen, I don’t know what could be different, so that’s a little confusing. I just tried it with 2016.

    The only thing that I can think of is some kind of conflict with another field on the page. Are there any other field groups are used on the same location?

  • Ok, it appears to be a Chrome bug of some kind, because the default values work just fine in Firefox.

    And yes that’s correct, I’m referring to the values under the Panel Options tab, namely “Top Spacing”, “Bottom Spacing”, and “Background Type”, in all layout types except “Plain Code”, which does work for some reason. In fact, if I remove the panel options clone field from the “Plain Code” layout, it will make the default values in the second-to-last layout (“Quote”) work properly.

    So it appears that in Chrome, the default values within a clone field only work in the last layout type that has that clone field group. But you can add as many panels as you want, in any order, it only matters which layout it is. I can also reorder the layout types to make the “Content (1 to 4 columns)” layout type the last one, then the default values will work in all panels of this layout type, but not in the other layout types.

    I have no other field groups on my test install, just the ones I attached earlier. No JS errors. Plainest vanilla WP install possible.

    I inspected the code and noticed that <b>the radio buttons that should be checked ARE marked as checked in the code</b> (both in the label class, and in the input itself, as ‘checked=”checked”‘). This is true before trying to update the page, as well as after trying to update the page (which then gives me the error messages, as in the screenshot attached).

    For some reason, <b>Chrome isn’t activating those radio buttons, even though they’re definitely marked as “checked”.</b> I thought it might have to do with visibility (like jQuery tabs not initiating when in a hidden div), but even when removing the Tab fields, it doesn’t work (and the last layout type does work with tabs anyway). I can see no differences in the code between different layout types that might cause radios to get checked or not. The radio input IDs and names are all unique, so there shouldn’t be any conflicts there. When I manually check the “already checked” radio button, the code doesn’t change, except for adding a :before pseudo element to the radio button to visually mark it as checked.

    I have no idea if the problem is with Chrome, ACF, or just a miscommunication between the two. See if you get the same problem in Chrome. I’m using Version 52.0.2743.116 m.

    At this point though, if you tell me you’ve troubleshooted things on your end and the problem is not coming from ACF, but rather from Chrome, then I will consider the issue “solved”, and hopefully a later Chrome version will fix the problem. I’m very curious as to why the radio buttons aren’t being checked though…

    Thanks for the help, let me know if you find out anything!

  • I have reported the issue to the developer. I don’t know if it’s an ACF or a Chrome bug. Will let you know if I hear anything.

  • Hi guys

    Thanks for the bug report.
    This is a great little issue caused by a combination of Chrome + flexible content + the same radio field within multiple layouts (clone field)!

    I’ve found a simple fix that solves the issue and will update the latest 5.4.3-RC2 version available in your my-account section online:
    http://www.advancedcustomfields.com/my-account

    If possible, can you please download and test the latest build of ACF PRO?
    1. Login to your account online: http://www.advancedcustomfields.com/my-account
    2. Click on the ‘see all versions’ link next to your license
    3. Download the latest RC2 version​​

    Please let me know if it solves the issue for you (remember to hard refresh your browser to clear cached JS)

    Thanks
    Elliot

  • Yep, this solves it, thanks!

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

You must be logged in to reply to this topic.