Conditional Meta Box Does Not Work on Frontend

Support MB Conditional Logic Conditional Meta Box Does Not Work on Frontend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33386
    armandmorinarmandmorin
    Participant

    I have a radio button on the frontend form, when selected it should display specific meta boxes.

    The issue is on the frontend, Conditional Logic is working perfectly for fields, but it does nothing on the hiding or showing the actual meta box itself.

    I tested the same code in the backend custom post type and it works perfectly. It displays and hides the meta box as it should. But on the frontend nothing happens. I have even tried Meta Box Show Hide and the same results as well.

    Ideas?

    #33390
    armandmorinarmandmorin
    Participant

    Also forgot to say... I'm using the Metabox AIO.

    #33391
    Armand MorinArmand Morin
    Participant

    I turned off Conditional Logic in Metabox AIO and uploaded the individual plugin and everything work fine. So it's something with Metabox AIO that's missing for Conditional Logic.

    #33393
    Long NguyenLong Nguyen
    Moderator

    Hi Armand,

    Can you please share the code that creates the fields and logic on your site? You can also troubleshoot the issue by deactivating all plugins except Meta Box, Meta Box AIO and switching to the standard theme of WordPress (Twenty TwentyOne).

    #33394
    Armand MorinArmand Morin
    Participant

    Here's the code I am using. Like I said it works perfectly with the individual plugin, but not with AIO.

    
    $meta_boxes[] = [
            'title'      => 'What Kind of Player',
            'post_types' => 'ctavideos',
            'id'    => 'ctavideos_decision_player_metabox',
            'class' => 'fieldwrapper',
    
            'fields' => [
    
                [
                    'type' => 'heading',
                    'name' => 'What kind of player do you want to create?',
                    'desc' => 'Choose the kind of player you want to create by selecting your option below.',
                ],          
                [
                    'name'  => 'Select The Type of Player',
                    'id'    => 'ctavideos_kind_of_player',
                    'type'  => 'radio',
                    'options' => array(
                            'standard' => 'Standard Player',
                            'ctaplayer' => 'Call To Action',
                            'playlistplayer' => 'Playlist Player',
                        ),
                    //'inline' => true,
                    'columns' => 12,
                ],
            ]
        ];
    
       $meta_boxes[] = [
            'title'      => 'Video Playlist',
            'post_types' => 'ctavideos',
            'id' => 'ctavideos_playlist_metabox',
            'hidden' => array( 'ctavideos_kind_of_player', '!=', 'playlistplayer' ),
            'class' => 'fieldwrapper',
            'columns' => 12,
    
            'fields' => [
                [
                    'type' => 'heading',
                    'name' => 'Video Playlist',
                    'desc' => 'Enter the details below for your videos and information you want in the playlist.',
                ],
                [
                    'id'     => 'playlist_group_id',
                    'type'   => 'group',
                    'clone'  => true,
                    'add_button' => 'Add Another Video',
                    'sort_clone' => true,
                    'group_title'  => 'Playlist Video Details',
                    'collapsible'   => 'false',
    
                    'fields' => array(
                        array(
                            'name'  => 'Upload Your Video',
                            'id'    => 'ctavideos_playlist_videos',
                            'type'  => 'file_input',
                            'placeholder'  => 'Enter the url of your call to action.',
                        ),
                        array(
                            'name'  => 'Link Text',
                            'id'    => 'ctavideos_playlist_link_text',
                            'type'  => 'text',
                            'placeholder'  => 'Enter the button text. ie.) Click Here',
                        ),
                        array(
                            'name'  => 'Poster Image',
                            'id'    => 'ctavideos_playlist_poster',
                            'type'  => 'file_input',
                        ),
                    ),
                ],
            ]
        ];
    
    #33403
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You need to include two meta box IDs in the frontend shortcode to make the conditional logic works on the frontend. It's just the JavaScript code to show/hide HTML elements.

    [mb_frontend_form id='ctavideos_decision_player_metabox,ctavideos_playlist_metabox']
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.