Support

Account

Home Forums General Issues Custom field type + Conditional logic

Solved

Custom field type + Conditional logic

  • I have created a custom field type based on the new field type template:
    https://github.com/AdvancedCustomFields/acf-field-type-template

    What do I need to do for my custom field type to be able to be used as conditional logic for other fields? When I try to show another acf field based on if my custom field has any value I can’t even choose it in the list. Any field that is using my custom field type is grayed out in the list of conditional logic fields.

    Conditional Logic

  • 15 minutes after posting I figured it out…

    It’s added with javascript:
    acf.registerConditionForFieldType('hasValue', 'custom_field_type_name_here');

  • SORRY for highjacking your thread.

    Any change you could share a working demo of a custom implementation?

    Currently i’m trying to see if i can make the following field working https://github.com/kevinruscoe/acf-star-rating-field/tree/master with acf’s conditional logic.

    So i added the to the input.js

    var star_field = acf.Field.extend({ type: 'star_rating_field' });
    		acf.registerFieldType(star_field);
    		acf.registerConditionForFieldType('equalTo', 'star_rating_field');

    .

    Now i’m able to select conditions in other fields and select that field. The only issue is the conditions are not working so i have the feeling i’m missing some code to make this to work. Any ideas?

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

You must be logged in to reply to this topic.