Home › Forums › Backend Issues (wp-admin) › Conditional logic broken on some cases after updating to 5.2.6
I have a problem with the conditional logic after updating to 5.2.6.
I have created a Flexible content field where some fields are hidden based on the select field on the settings tab. For example, I have a slider-field, where it’s possible on the settings tab to select whether to show content on the slide or not.
This used to work but now it’s not respecting the saved settings. If I go to the settings tab and deselect the content and reselect it, the conditional logic is working. However after saving the post the conditional logic is broken again and it is showing only the first item.
There’s no js-errors. The fields are hidden by the class “hidden-by-conditional-logic”.
It would seem that you’ve come across a good olé fashion bug.
I will make a bug report out of this.
To be clear, what’s happening is that a loaded edit screen (or reloaded after an update or save) does not respect the conditional logic when the triggering field is in a different tab within the same field group?
That’s right, the conditional logic is not respected when the field is on a different tab within the same field group.
I have come across another instance of conditional logic acting weird on 5.2.6.
Add a stylized multi-select, and then add fields conditionally shown based on the value of the select. After saving, it seems the fields that should show based on the multiselect values disappear. They come back if you add/remove items, but is never shown correctly on first page load.
Version 5.2.5 doesn’t have this bug.
I now have version 5.2.8 but the bug still exists. Any news for this?
I’m tagging in @elliot so that he is notified of this bug!
I’m also experiencing some difficulty with the conditional functionality.
I’m using ACF Pro 5.3.1 in WP 4.3.1. (OSX 10.9.5)
The problem seems to have begun after the last update.
Conditional logic was working fine previously. Now the same field groups are not functioning. Depending on certain selections, fields disappear, and/ or become un-editable. I’ve tried rebuilding the field group, reinstalling the plugin, using it in conjunction with another theme and re-installing WordPress. Alas the problem persists.
Any thoughts? Such a grand plugin really….
Uploading a screen grab to illustrate issue mentioned above. Through trial and error, I can fix the problem by removing all conditional logic, but then, of course, things get a little messy.
Has this been resolved, I am experiencing a similar issue with conditional logic on a combobox. When I select a particular value it doesn’t remove a textbox lower down on the form. However, when adding a new post this conditional logic works.
I’ve notified Elliot of this in our bug tracker.
Hopefully he’ll be able to take a look at it soon enough!
Elliot here – ACF dev.
I’ve juts done some testing but am unable to replicate the issues mentioned above
Can you please export your field group to .json and attach it to your reply.
I would like to test your exact setup to better replicate the issue
Here’s my export. It fails for me when I toggle the combobox for field called “Type” it should toggle the field called “Trade Accepted” when I am editing the post. New posts work fine, it toggles the field on/off.
Thanks for the .json attachment. I’ve imported your field group and and tested your conditional logic which worked perfectly as expected for both adding a post and editing one.
It may be possible that your post edit page contains some JS which is conflicting with and preventing ACF from running.
Are you able to setup a blank WP site and import your .json to do some testing. Perhaps you will be able to find the culprit by adding in your plugins / theme one at a time
Sure, I’ll give that a go. The console is not showing any errors so I’ll activate and deactivate some plugins.
Ok I deactivated all plugins except ACF, used Twenty Sixteen theme and it still doesn’t hide my field…
Any other suggestions? I’m on the latest version of ACF 5.4.4 and latest WordPress version 4.6.1.
I’m testing the site locally on a WAMPSERVER instance.
Thanks for the reply.
Just to confirm – only 1 of your fields contains conditional logic (trade_accepted).
– It should show when ‘trade_offer_type’ is equal to ‘trade’ OR ‘wanted’.
– it should hide when ‘trade_offer_type’ is equal to ‘giveaway’
This is exactly what it does for me. Perhaps you can setup a site online for us both to login and test?
Yes that’s correct Elliot! Ok, good idea, I’ll do that tonight. Thanks very much for your assistance it’s greatly aprpeciated 🙂
Ok @elliot , I’ve uploaded the site. Create yourself an account, ADD A TRADE and then try and edit it.
After adding a trade you can view your trades here
Let me know how you go.
@elliot any updates mate? 🙂
I am using ACF v5.4.6 with a brand new, blank WordPress install (v4.6.1), running the default, twentysixteen theme, and I am having an issue with certain conditional logic as well.
I’ve got a ton of fields on a custom post type, most of which are all conditionally dependent upon one particular field, and all the ones operating off of that conditional rule are working perfectly fine. However, there are two fields who are supposed to be conditionally dependent upon the value of a different field than the others, and I cannot get those two fields to display conditionally no matter what.
I’ve tried disabling the conditionally logic on the field for which these two non-functioning fields are conditionally dependent, and that doesn’t fix the issue. I’ve tried switching the field type to a number of different field types, also with no luck.
Short of deleting these fields and recreating them, hoping that makes a difference for whatever reason (UPDATE: This did nothing), can anyone think of anything else that may be causing this hiccup, when all my other conditional fields are functioning perfectly?
Update: So I was using a radio button field with two possible values, both of which ended with a colon (:). Removing the colons from the values fixed this issue, which I’ve since come to learn is because this field allows you to specify a label and a value per line, separated by a colon. It all makes sense to me now. Sorry for any confusion. Just be careful using colons here folks. Label : Value, results in a blank value if your line ends in a colon. Doy!
Sorry for the late reply. I didn’t receive any notification about your comment. Please note that this is a community forum and if you require any support for a bug, please create a ticket: http://support.advancedcustomfields.com/new-ticket/
I’ve looked at your add trade / edit trade forms and can see the issue. Your ‘add trade’ form works well because the acf-input.js script is being enqueued in the head as it should be. Your ‘edit trade’ form is different, it loads the JS file in the footer which is preventing the conditional logic from being added.
Please be sure to use the acf_form_head() function correctly so that ACF CSS and JS are appended to the ehad, not footer
I moved the function acf_form_head() above the themes function get_header() and now it seems to work.
I didn’t recognize when exactly, but after some update conditional logic was broken.
Now I have installed ACF 5.6.1 and conditional logic seems doesn’t work (or at least doesn’t work in some cases).
It was worked before, but now when I set up to show a particular field for certain values of another field, this particular field is never displayed (for any values of the second field). If I set up to show a particular field when the value of another field is not equal to some given value, then my particular field is always displayed (also for any values of the second field).
An interesting detail: sometimes (in rare cases) conditional logic still works. But in most cases in exactly the same situation (exactly with the same fields) it does not work.
P.S.: I do not have any tabs for these specific fields.
Can you please open a new support ticket and be sure to attach your field group .json export so we can try to replicate the issue?
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.