Support

Account

Forum Replies Created

  • Okay, i got it. But it was rather tricky.

    To be able to inherit the conditional logic you field has to have either of these name: select, checkbox or radio.

    But since that these fields already exists, we’re aren’t to use the conditional logic.

    This lives in the field-group.js file (which is minified to field-group.min.js).

    Okay, so far so good. We can’t do anything to make our custom fields use the conditional logic – without hacking.

    My solution endend up with this small javascript piece which i inject to the edit page (for the custom fields not the post):

    
    ;(function($){
        var myFieldName = 'my-field';
    
        $(document).ready(function () {
            $(document)
            .find('[data-type="'+ myFieldName +'"]')
            .attr('data-type', 'radio');
        });
    })(jQuery);
    

    This “hack” changes the field type to a radio which makes it available for the conditional logic.

    I definitely think that this should be change in ACF, it’s just silly that we have to make these kind of hackes to make it work..

    Hope it helps some one else.

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