Support

Account

Home Forums ACF PRO Conditional Logic on Custom Fields

Solving

Conditional Logic on Custom Fields

  • Hi All

    We are using Pro.

    We really really want to use the image-select plugin which has been written. It works lovely.

    The problem is a lack of conditional logic.
    We have seen the ‘hacks’ to enable this – but for the life of us we just cannot get the conditional logic fields to appear.

    The JS below allows the fields to appear in the ‘choose which field to use for the conditional logic on’ to work (line 22)

    Has anyone got any ideas at all how we could make this work?

    jQuery(document).ready(function() {
    
    	// On label click, change the input and class
    	jQuery(document).on('click', '.acf-image-select label img, .acf-image-select label .acf-image-select-title', function(e) {
    		var id         = jQuery(this).closest('label').attr('for');
    		var parentList = jQuery(this).closest('ul.acf-image-select-list');
    		
    		parentList.find('.acf-image-select-selected').removeClass('acf-image-select-selected').find("input[type='radio']").attr("checked",false).removeAttr("data-checked");
    		
    		jQuery('label[for="' + id + '"]').addClass('acf-image-select-selected').find("input[type='radio']").attr("checked",true).attr("data-checked","checked");
    
    		console.log('changed');
    
    	});
    
    });
    
    (function($){
    	$(document).ready(function () {
    		$('[data-type="image_select"]')
    		.attr('data-type', 'radio'); // here is the change
    	});
    })(jQuery);
    
  • Are you talking about a custom field type created by a 3rd party? Where can I find it? It does not already have a conditional logic block?

  • Have you got this to work @senses ? I got the same problem. I am guessing you are using https://github.com/cyberwani/ACF-Image-Select ?

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

The topic ‘Conditional Logic on Custom Fields’ is closed to new replies.