Home Forums Feature Requests Conditional Logic for Clone fields


Conditional Logic for Clone fields

  • Would it be possible to make Conditional Logic available for Clone fields?

    Clone fields are AWESOME and this would make them even more awesome.

    Based on a select list choice I’d like to dynamically display different clone fields.


  • I just came here to sign up to the forum to ask the same question.

    Good news! While I was waiting for my validation email I figured out that this is already a feature. You just need to change the “Display” setting on the clone field to “Group”, then the conditional logic options will appear.

  • boom! nice find

    thank you

    maybe switch my feature request to update the documentation page for the Clone field with this tip

  • Although changing the fields to a group works. is there a reason for this? I much prefer to have the clones seamless instead of groups as this add visual clutter.


  • Would be interested to know as well, since I often use clones within a group, this creates unnecessary wrapping, would love to have conditional logic in either way as well.

  • When using the seamless and you include the same fields multiple times at the same level the fields will have the same field names and they are at the same level. Not only will you have trouble with conditional logic, you will also have trouble saving the data in the fields, since they both have the same name the saving of the 2nd, 3rd, etc fields will overwrite the previous values. In essence you only have one field shown multiple times. Seamless is meant for reusing the fields in a repeater or flex field where they already have some protection.

    When grouped they work more like the sub fields of a repeater or flex field. The field names are prefixed, the fields have parents, and this prevents the issues.

    This is all explained in the clone field documentation. See Limitations and Notes near the bottom of the page.

  • I use clone fields heavily to make managing component blocks and their fields easier. There are some things about the Group setting that I dislike similar to alpipego. Since the seamless fields have conditional displays within that field group, is it possible to have a “nested” set of display fields for seamless fields too that are honored at the parent-level? For example:

    Background Settings Field Group

    – Background Type (radio)
    — Option 1: None
    — Option 2: Color
    — Option 3: Image
    – Background Color (color picker; displays when “Option 2: Color” is selected)
    – Background Image (image; displays when “Option 3: Image” is selected)

    Then in a flexible field, there is a group of flexible fields that reuses the background settings field group like so.

    – Content (WYSIWYG)
    – Media Type (radio)
    — Option 1: Image
    — Option 2: Form
    – Image (image; displays when “Option 1: Image” is selected)
    – Form (post object; displays when “Option 2: Form” is selected)
    – Form Background (clone; displays when “Option 2: Form” is selected) <– Honor this conditional display in parent flexible fields, and then honor conditional display in fields of field group

  • @jongc

    There is a way to do this, but not by using the admin controls and I can’t give you the full code because it would be fairly complicated.

    What you need to do is to alter the conditional logic of the field. This can be accomplished but creating an acr/prepare_field filter for the field in questions. In this filter you would look at $field[‘parent’] and this might let you determine if the field is used in the way you have it set up. If you can, and it is, then you could alter the conditional logic for the field to make it work the way you want it to.

    I have done similar things in the past. This code is an example from a recent project and I use this filter to remove sub fields base on the parent field in some cases.

    function remove_fields_on_theme_options($field) {
      // remvove some layout fields on options page
      $fields = array(
      if (in_array($field['key'], $fields)) {
        $parents = array(
        if (in_array($field['parent'], $parents)) {
          return false;
      // remove all layout fields and CTA tab inside of quick links
      $fields = array(
      $parents = array(
      if (in_array($field['key'], $fields) && in_array($field['parent'], $parents)) {
        return false;
      return $field;
  • I see what you mean John. Thanks for the insight.

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

The topic ‘Conditional Logic for Clone fields’ is closed to new replies.