Custom Fields
Re-Envisioned
Support General Image Advanced Required Validation Not Working

  • Creator
    Topic
  • #20475
    Resolved ossama saeed
    Participant

    Hello guys,

    The required validation for the advanced image is not working

    
    add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );
    function prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array(
            'title'      => 'Logos',
            'post_types' => 'news',
            'fields' => array(
                array(
                    'name' => 'Add Logos ?',
                    'id'   => 'news_logos',
                    'type' => 'checkbox',
                    'std'  => 0, // 0 or 1
                ),
                array(
                    'name'  => 'Title',
                    'id'    => 'news_logos_title',
                    'type'  => 'text',
                    'visible' => array( 'news_logos', true ),
                    'required' => 1,
                ),
                array(
                    'name'  => 'Logo',
                    'id'    => 'news_logos_img',
                    'type'  => 'image_advanced',
                    'max_file_uploads' => 1,
                    'visible' => array( 'news_logos', true ),
                    'clone' => true,
                    'sort_clone' => true,
                    'required' => 1, // This is not working 
                ),
            ),
            'validation' => array(
                'rules'  => array(
                    'news_logos_img' => array(
                        'required'  => true, // This is not working 
                    ),
                ),
                'messages' => array(
                    'news_logos_img' => array(
                        'required'  => 'This field is required',
                    ),
                )
            )
        );
    
        return $meta_boxes;
    }
    

    Thanks in advanced

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #20483
    Long Nguyen
    Moderator

    Hi,

    I’m going to check it out and let you know later.

    Thank you.

    #20559
    ossama saeed
    Participant

    Hi Long,

    Any updates regard this problem ?

    #20627
    Long Nguyen
    Moderator

    Hi,

    Please update the new version of the plugin Meta Box v5.3.2 to fix this issue.

    #20645
    ossama saeed
    Participant

    It is working now.

    Thank you,

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