Hi, I have this situation: I want to create a form that can be submitted from front end, but among my fields I have a list field with values loaded dynamically from a array.
If I look at the changes from the backend everything is ok, but if I look at the form from the frontend the field remains empty.
Please see the example:
$myArray = array('first', 'second', 'third');
if ($myArray) {
$mylist = array_combine($myArray, array_values($myArray));
} else {
$mylist = null;
}
add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );
function prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array(
'title' => 'Personal Information',
'post_types' => 'post',
'id' => 'myform',
'fields' => array(
array(
'name' => 'List',
'id' => 'MyList',
'type' => 'checkbox_list',
'options' => $mylist,
),
)
);
return $meta_boxes;
}
I use this shortcode on the page
[mb_frontend_form id="myform"]