Support Forum
After i upgrade to Meta Box 5.10.0
Visible condition not work anymore
[
'name' => __( 'Check', 'pmbds' ),
'id' => 'check_unique',
],
'visible' => [
'when' => [['contact', '!=', '']], // set minh minh set
'relation' => 'or',
],
],
Hello,
Please export the field group to a JSON file and share it here. I will check the issue on my demo site. I re-test the issue with two simple text fields and see that the visible conditional logic still works properly.
Following the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--import
Hi, this error happen only if i use Condition for Cloneable Text field
Text 1: Text Field - Cloneable
Text 2: Condition - Show only if Text 1 is not empty << not working in Meta Box 5.10.0
{
"post_type": "meta-box",
"post_name": "test",
"post_title": "Test",
"post_date": "2024-08-29 11:37:03",
"post_status": "publish",
"post_content": "",
"settings": {
"object_type": "post",
"post_types": [
"properties"
],
"context": "normal",
"priority": "high",
"style": "default",
"closed": false,
"default_hidden": false,
"autosave": false,
"class": "",
"prefix": "",
"text_domain": "your-text-domain",
"function_name": "your_prefix_function_name"
},
"fields": {
"text_xwx1k9uur4r": {
"_id": "text_xwx1k9uur4r",
"name": "Text 1",
"id": "text_1",
"type": "text",
"label_description": "",
"desc": "",
"std": "",
"text_limiter": {
"limit": "",
"limit_type": "character"
},
"placeholder": "",
"size": "",
"required": false,
"disabled": false,
"readonly": false,
"prepend": "",
"append": "",
"datalist_choices": "",
"clone": true,
"sort_clone": true,
"clone_default": false,
"clone_as_multiple": true,
"clone_empty_start": true,
"min_clone": "",
"max_clone": 6,
"add_button": "+ Add New",
"columns": 12,
"tooltip": {
"enable": false,
"icon": "",
"position": "top",
"content": ""
},
"before": "",
"after": "",
"class": "",
"sanitize_callback": "",
"save_field": true
},
"text_ldicmukcwjc": {
"_id": "text_ldicmukcwjc",
"name": "Text 2",
"id": "text_2",
"type": "text",
"label_description": "",
"desc": "",
"std": "",
"text_limiter": {
"limit": "",
"limit_type": "character"
},
"placeholder": "",
"size": "",
"required": false,
"disabled": false,
"readonly": false,
"prepend": "",
"append": "",
"datalist_choices": "",
"clone": false,
"sort_clone": false,
"clone_default": false,
"clone_as_multiple": false,
"clone_empty_start": false,
"min_clone": "",
"max_clone": "",
"add_button": "",
"columns": 12,
"tooltip": {
"enable": false,
"icon": "",
"position": "top",
"content": ""
},
"before": "",
"after": "",
"class": "",
"sanitize_callback": "",
"save_field": true,
"conditional_logic": {
"type": "visible",
"relation": "or",
"when": {
"vu6nqbqgc": {
"id": "vu6nqbqgc",
"name": "text_1",
"operator": "not contains",
"value": ""
}
}
}
}
},
"data": [],
"meta_box": {
"title": "Test",
"id": "test",
"post_types": [
"properties"
],
"closed": false,
"default_hidden": false,
"autosave": false,
"text_domain": "your-text-domain",
"function_name": "your_prefix_function_name",
"fields": [
{
"name": "Text 1",
"id": "text_1",
"type": "text",
"required": false,
"disabled": false,
"readonly": false,
"clone": true,
"sort_clone": true,
"clone_default": false,
"clone_as_multiple": true,
"clone_empty_start": true,
"max_clone": 6,
"add_button": "+ Add New",
"limit_type": "character"
},
{
"name": "Text 2",
"id": "text_2",
"type": "text",
"required": false,
"disabled": false,
"readonly": false,
"clone": false,
"clone_empty_start": false,
"limit_type": "character",
"visible": {
"when": [
[
"text_1",
"not contains",
""
]
],
"relation": "or"
}
}
]
}
}
The previous version 5.9.0 works perfectly with this conditon
Hello,
Thanks for your details. There is an issue with the cloneable field in the new version of Meta Box. I can reproduce the issue on my demo site and I've escalated this to the development team. It should be fixed in the next update of our plugins.
You can remove the cloneable option of the field to use the conditional logic in the meantime.
Hi justdoit123,
We have fixed the issue in the latest version, please update Meta Box and the Meta Box Conditional Logic plugins.
Also, please use different syntax for your conditional logic,
Your current logic:
"when": [
[
"text_1",
"not contains",
""
]
],
Please change to:
"when": [
[
"text_1",
"!=",
""
]
],
Because currently, a text always contains empty string so your logic always falsy, you you just need to check if text is not empty.
Cheers!