Home Forums Backend Issues (wp-admin) Clone field: conditional logic not available


Clone field: conditional logic not available

  • If you clone a field e.g. radio/checkbox/boolean field you cannot use the properties of the clone in any conditional logic for that field group.

    Only tested in flexible content but assume the same is true on all other fields. Not sure if this should be a feature request or a bug report as I would expect the functionality to be available however understand why it may not be.

    As a workaround I’ve duplicated the field but this creates inconsistency with some duplicate fields and some clone fields.

    Many thanks

  • I’m not sure if I understand your question correctly, but if you set the display mode of the clone field to “group” instead of “seamless” you’ll be able to set all the conditional login in your clone field. Hope that helps:)

  • Hello Luukx20, I couldn’t get your suggestion to work.

    If I clone a radio field in the same field group (flexible content) but sitting in a different layout I cannot use the conditional logic options irrespective of whether it’s seemless or group. I just see “no toggle fields available”. Perhaps I’m doing something wrong but I can’t see how conditional logic can be used on a cloned sibling field.

    Very happy to be pointed in the right direction but toggling between group and seamless doesn’t appear to make any difference.

  • You need another toggle field in the same layout or in a field that the layout can access. Basically, you need another toggle field either in the same layout as the cloned field or in the parent field or field group of the flex field. You can’t make it conditional based on a field in another layout.

  • Hello John,

    That’s what I suspected which isn’t ideal although I appreciate that there will be an opportunity cost of features like this versus the complexity of the underlying code. Perhaps something to add to the wishlist?

  • You could try submitting a ticket for a feature request, but generally requests for adding more complex conditional logic are low on the developer’s priority list.

    It is possible to extend the conditional logic yourself, an example of it was given in this topic

  • I was trying to do the same thing and I came up with an alternate solution.

    I set the Clone field’s Display to Group and then gave it a CSS class of fake-seamless.

    Then I just created a file with some simple CSS and enqueued it to the page using the acf/input/admin_enqueue_scripts action.

    The CSS I used was:

    .acf-fields > .acf-field.fake-seamless { padding: 0; }
    .acf-field.fake-seamless > .acf-label { margin: 0; }
    .acf-field.fake-seamless > .acf-label label { display: none; }
    .fake-seamless .acf-clone-fields { border: none; }
Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Clone field: conditional logic not available’ is closed to new replies.