Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic TypeError: logics is undefined

  • Creator
    Topic
  • #18497
    Resolved Austin Passy
    Participant

    TypeError: logics is undefinedconditional-logic.js:221:18

    You should check for the logics object before sub checks, like:

    var relation = typeof logics !== 'undefined' && typeof logics.relation !== 'undefined' ? logics.relation.toLowerCase() : 'and',
                success = relation === 'and';
Viewing 10 replies - 1 through 10 (of 21 total)
  • Author
    Replies
  • #18512
    Anh Tran
    Keymaster

    Hi Austin,

    Thanks for your feedback. I guess, it’s a sign that there’s a problem with the logic syntax. Can you please check it first? And if possible, please send me the code for meta boxes, so I can double check.

    Thanks

    #18570
    woorise
    Participant

    I get the same error “TypeError: logics is undefined” when I use conditional logic in a field which is part of a group field.

    #18576
    Anh Tran
    Keymaster

    Can you please post the code of your meta box?

    #18577
    woorise
    Participant

    Thanks for the quick respond Anh. In my case I found that the issue occurs when I include the following characters as a placeholder in the field I want to hide: “ ”

    Here is the part of the code:

    [
    ‘name’ => esc_html__( ‘Field’, ‘test’ ),
    ‘id’ => ‘field’,
    ‘type’ => ‘textarea’,
    ‘visible’ => [ ‘test_field’, ‘!=’, ” ],
    ‘placeholder’ => ‘ ’,
    ],

    #18578
    woorise
    Participant

    *forgot to include it between code tags:

    'placeholder' => ' ',

    #18579
    woorise
    Participant

    again it strips out the characters. I will use spaces this time:

    & # 1 0 ;

    #18597
    Anh Tran
    Keymaster

    Can you post the code on pastebin.com? The forum auto strips all unwanted characters.

    #19282
    Austin Passy
    Participant

    Just getting around finally to looking into this issue further now.

    I’ve tracked it down to an issue on a taxonomy type field with field_type set to select_advanced.

    Current condition:

    
    'visible' => [
                'tax_input[promo_type]',
                'contains',
                16,
            ]
    

    Also tried to different syntax’s like [slug:tax_input[promo_type], 'contains', 'term-slug'], [slug:tax_input[promo_type], '=', 'term-slug'], [tax_input[promo_type], '=', 16].

    #19295
    Brian
    Participant

    Hi Anh,
    I’m getting the same error. Did you all find a solution? I can’t figure out why the conditional logic isn’t adding in the style=”display:none;” or “display:block;” to show/hide fields?

    I created everything in a different site which has the “Meta Box Builder” plugin activated and the conditional logic works on that site. But as soon as I copy the exact code to a different site and install the required “conditional logic” plugin. It does not work. I’ve tried to find what would be different between sites and can’t find much?

    What am I missing here?
    Thanks,
    Brian

    #19301
    Long Nguyen
    Moderator

    Hi Brian,

    Could you please share your code which uses conditional logic? I will check it on my end.

Viewing 10 replies - 1 through 10 (of 21 total)
  • You must be logged in to reply to this topic.