Conditional logic using switch stopped working
- This topic has 7 replies, 5 voices, and was last updated 8 months ago by
Tan Nguyen.
-
AuthorPosts
-
July 30, 2024 at 8:13 AM #46049
Travis Reason
ParticipantI have a set of custom fields using conditional logic to display a group only when a switch is activated. I've used this many times before. A template site I built months ago using this has stopped working. Now, when I activate the switch, the group does not display. Also, on another set of fields I added this feature and it doesn't work either, but in reverse. The field ALWAYS displays, whether the switch is activate or not.
More details here: https://drive.google.com/file/d/1buveXweykCaVyiiNw2OH8QXU20-g6GFC/view
July 30, 2024 at 10:02 PM #46054Peter
ModeratorHello Travis,
Please export the field groups on the site where the conditional logic doesn't work. I will import field groups on my site and see what happens there.
Please follow the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--importSeptember 3, 2024 at 2:54 AM #46309Travis Reason
ParticipantSorry, I just saw your reply. I have the fields exported and you can download them here: https://drive.google.com/file/d/12TDXfvf8qaY7AgQ5TlniKM0lodLvpV8L/view?usp=sharing
September 5, 2024 at 10:34 PM #46342Peter
ModeratorHello,
The issue occurs due to the wrong field ID format that you add to the conditional logic of the field "blog_switch", screenshot https://imgur.com/jil75AH
I remove that logic and the logic of the group field and CTA switch work properly.September 7, 2024 at 1:43 AM #46350Travis Reason
ParticipantThat was it! I didn't even look in the conditional formatting for the switches! Thank you
September 10, 2024 at 3:34 PM #46390Marcio Gouveia
ParticipantWell, I have similar approach to show hide fields based on the switch.
I use it on multiple sites. Yesterday I noticed it stopped working on one of them (I had just updated metabox AIO to 1.30.1). I went to another site, which was still on 1.30.0 and everything was working on my site. Just to be sure it was the update, i updated this second site to 1.30.1, and, voilá, all switches conditional logic stopped working.
I don't think the same solution provided for Travis applies.
September 11, 2024 at 5:12 AM #46406RBD
ParticipantAs above I am also having the same issue with conditional logic after the latest update.
- Appears to be a JS issue.
- My conditional logic based on switches have stopped working, I have to save the page and reload in order for the fields to show.
- Here is the error I can see in console
jquery.min.js?ver=3.7.1:2 Uncaught Error: Syntax error, unrecognized expression: ##type_1:not(.rwmb-clone-template ##type_1) at I.error (jquery.min.js?ver=3.7.1:2:11769) at Y (jquery.min.js?ver=3.7.1:2:17234) at re (jquery.min.js?ver=3.7.1:2:20008) at Function.I (jquery.min.js?ver=3.7.1:2:7520) at Function.<anonymous> (jquery-migrate.min.js?ver=3.4.1:2:2898) at e.<computed> [as find] (jquery-migrate.min.js?ver=3.4.1:2:1582) at ce.fn.init.find (jquery.min.js?ver=3.7.1:2:21991) at ce.fn.init (jquery.min.js?ver=3.7.1:2:22483) at e.<computed>.<anonymous> (jquery-migrate.min.js?ver=3.4.1:2:2438) at new e.<computed> (jquery-migrate.min.js?ver=3.4.1:2:1582) jquery.min.js?ver=3.7.1:2 Uncaught Error: Syntax error, unrecognized expression: ##type_1:not(.rwmb-clone-template ##type_1) at I.error (jquery.min.js?ver=3.7.1:2:11769) at Y (jquery.min.js?ver=3.7.1:2:17234) at re (jquery.min.js?ver=3.7.1:2:20008) at Function.I (jquery.min.js?ver=3.7.1:2:7520) at Function.<anonymous> (jquery-migrate.min.js?ver=3.4.1:2:2898) at e.<computed> [as find] (jquery-migrate.min.js?ver=3.4.1:2:1582) at ce.fn.init.find (jquery.min.js?ver=3.7.1:2:21991) at ce.fn.init (jquery.min.js?ver=3.7.1:2:22483) at e.<computed>.<anonymous> (jquery-migrate.min.js?ver=3.4.1:2:2438) at new e.<computed> (jquery-migrate.min.js?ver=3.4.1:2:1582)
September 11, 2024 at 12:27 PM #46409Tan Nguyen
ParticipantHi RBD, can you please share your meta box code (JSON or PHP) so I can replicate it?
Cheers!
-
AuthorPosts
- You must be logged in to reply to this topic.