Condition logic not working in Back-end

Support MB Conditional Logic Condition logic not working in Back-end

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29892
    Ghislain MalardierGhislain Malardier
    Participant

    Hi,

    I'm having an issue with custom fields. Since a couple update past, the conditional logic isn't working on the backend of the site, but works well on the front end.

    I tried deactivating everything, change theme, etc, but not luck.

    I have a 'Testimonial' CheckboxList field with 2 options. Depending of which one is selected (or both) it shows different options to fill info in.

    The weird thing is that if I select an option, after a while (maybe a minute) or randomly the hidden fields are showing, but don't disappear if I uncheck the option.

    Here is the code of a test I made to show the issue:

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'  => __( 'test', 'your-text-domain' ),
            'id'     => 'test',
            'fields' => [
                [
                    'name'    => __( 'Checkbox List', 'your-text-domain' ),
                    'id'      => $prefix . 'checkbox_list_1',
                    'type'    => 'checkbox_list',
                    'options' => [
                        1 => __( '1', 'your-text-domain' ),
                        2 => __( '2', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Text 1', 'your-text-domain' ),
                    'id'      => $prefix . 'text_tzwv68o6dh',
                    'type'    => 'text',
                    'visible' => [
                        'when'     => [['checkbox_list_1', 'contains', 1]],
                        'relation' => 'or',
                    ],
                ],
                [
                    'name'    => __( 'Url', 'your-text-domain' ),
                    'id'      => $prefix . 'url_gm8gpywfp5',
                    'type'    => 'url',
                    'visible' => [
                        'when'     => [['checkbox_list_1', 'contains', 2]],
                        'relation' => 'or',
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #29913
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I didn't see the issue like that, screen record https://www.loom.com/share/2ec8f7c28566454db4c07bcbfc498d13

    The conditional logic works based on JavaScript show/hide so it is possible that there is a plugin or a block of code that affects the function of conditional logic on your admin area. Please open the Console tab in the Inspect tool to check if there is an error message.

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