You should be able to deselect everything, save, and have things remaining deselected.
I just tried with the example found at https://github.com/CMB2/CMB2/wiki/Field-Types#multicheck-and-multicheck_inline and it worked for me.
Can you provide the CMB2 config you’re using for your example?
Here is how we are calling the multicheck if you need more let me know. Also this is running on an options page if that helps.
[
[
'name' => __( 'Active feeds', 'asd-feeds' ),
'desc' => __( 'Activate / Deactivate feeds', 'asd-feeds' ),
'id' => 'active_feeds',
'type' => 'multicheck',
'options' => array_column( $this->feeds, 'title', 'id' ),
],
[
'name' => __( 'Debug mode', 'asd-feeds' ),
'desc' => __( 'Enable debug mode, ie: more verbose logging.', 'asd-feeds' ),
'id' => 'debug',
'type' => 'checkbox',
],
];
Can you provide a static version of what is found in the feeds property for your usage? the part from $this->feeds
Do you have an email address that I can share a gist with? I’d rather not show code from a client.
confirming i did receive the email and have the php class provided. Took a few to figure out how to get a similar setup, set up. I replaced the $this->feeds with a generic array of key/value pairs.
Definitely able to recreate this one, and looking over the GitHub issues list, we had a similar case this past summer, that is still unresolved.
https://github.com/CMB2/CMB2/issues/978
Three options I can see at the moment.
1. This is a new one that I didn’t think of when I filed the issue. Have the multi-check option be the last time in the page. It seems to clear appropriately in that situation.
2. First from the GitHub issue above. I was able to get around it by setting a value in the 2nd one, and then unchecking the first ones, and that seemed to work. Then, on a 2nd save of the page, uncheck the second item and then all of them were empty finally. This was able to be done without the hidden field that you set.
3. Second from the GitHub issue above. An alternate idea that may help would just be to have a “none” option that you don’t actually do anything with on the frontend or wherever you’re using these values at.
Not sure exactly what the project specs are and how flexible you’ll be able to be here. Given the wonky nature of 2 of the ideas, I’d probably personally settle on idea 3 with the “none” option as a default.