Bug with checkboxes

Support MB Conditional Logic Bug with checkboxes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13230
    onpconpc
    Participant

    Hello 🙂

    I think there is an issue while using MB Conditional Logic and checkboxes.

    Here's my code :

    
                $meta_boxes[] = array(
                    'title'  => 'Popin',
                    'post_types' => array('page'),
                    'context'    => 'normal',
                    'priority'   => 'high',
                    'fields' => array( 
                        array(
                            'id'   => 'hp-popin',
                            'type' => 'checkbox',
                            'name' => 'Afficher une popin ?',
                        ),
                        array(
                            'id'   => 'hp-popin-title',
                            'type' => 'text',
                            'name' => 'Titre ?',
                            'visible' => array( 'hp-popin', '=', true )
                        ),
                        array(
                            'id'   => 'hp-popin-title-color',
                            'type' => 'color',
                            'name' => 'Couleur du titre ?',
                            'visible' => array( 'hp-popin', '=', true )
                        ),
                        array(
                            'id'   => 'hp-popin-text',
                            'type' => 'textarea',
                            'name' => 'Texte ?',
                            'visible' => array( 'hp-popin', '=', true )
                        ),
                        array(
                            'id'   => 'hp-popin-image',
                            'type' => 'file_advanced',
                            'max_file_uploads' => 1,
                            'name' => 'Image ?',
                            'visible' => array( 'hp-popin', '=', true )
                        ),
                        array(
                            'id'   => 'autosize-hp-popin',
                            'type' => 'checkbox',
                            'name' => 'Adapter la taille de la popin par rapport à son contenu ?',
                            'style' => 'rounded',
                            'on_label'  => '<i class="dashicons dashicons-yes"></i> Oui',
                            'off_label' => '<i class="dashicons dashicons-no"></i> Non',
                            'visible' => array( 'hp-popin', '=', true )
                        )
                    )
                );

    So, if the checkbox id hp-popin is checked, the others elements are shown. But, if the checkbox id autosize-hp-popin is checked, when publishing the post, the first one is still checked but the others elements are hidden... So, we have to uncheck the first one to display the others elements...
    I tried by using the switch element and it is the same behaviour.

    Did I make a mistake or is it really a bug ?

    #13332
    Anh TranAnh Tran
    Keymaster

    Hi, I've tried your code and it seems to be working fine. Here is my video: http://recordit.co/FupVhWSulF. Can you please take a look?

    #13342
    onpconpc
    Participant

    Hi Anh,

    Thanks for your answer ! Well, I have to go deeper in my code to find what is wrong

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