Conditional logic using switch stopped working

Support General Conditional logic using switch stopped workingResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #46049
    Travis ReasonTravis Reason
    Participant

    I 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

    #46054
    PeterPeter
    Moderator

    Hello 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--import

    #46309
    Travis ReasonTravis Reason
    Participant

    Sorry, 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

    #46342
    PeterPeter
    Moderator

    Hello,

    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.

    #46350
    Travis ReasonTravis Reason
    Participant

    That was it! I didn't even look in the conditional formatting for the switches! Thank you

    #46390
    Marcio GouveiaMarcio Gouveia
    Participant

    Well, 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.

    #46406
    RBDRBD
    Participant

    As 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)
    #46409
    Tan NguyenTan Nguyen
    Participant

    Hi RBD, can you please share your meta box code (JSON or PHP) so I can replicate it?

    Cheers!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.