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