Support

Account

Home Forums ACF PRO Conditional Logic

Solved

Conditional Logic

  • I am trying to find out if you can use the conditional logic just based on content being present. In my example I have a field to add an image. I’d like to add a conditional field that only shows up if an image is selected. Is there a way to check if content is present such as when an image is selected or a date has been added and if so allow a field with conditional logic to be displayed such as a text field where the user could enter a class name for that image. Or perhaps have that field only show up if a flexible content field is selected.

  • Conditional logic currently only works on choice fields. I’ve heard some rumors about it possibly adding to things like taxonomy fields but I can’t confirm that. It does not work on the presence or absence of a value in a field. For this you’d need to create you own JavaScript to handle the hiding/showing of a field. There isn’t much in the way of information on how to accomplish something like this. The only information on adding custom JS is here https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/. I have posted some examples of doing some things with JS here that may get you started on how to detect changes in fields and modify other fields here https://github.com/Hube2/acf-dynamic-ajax-select-example

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

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