I am trying to set visibility of an Advanced Select Box based on the checked value in a Checkbox List and I'm doing this via the Meta Box Builder extension in WP admin.
Although the doco is very clear in terms of code to achieve this (athttps://docs.metabox.io/extensions/meta-box-conditional-logic/) I am unsure what to select in the Builder UI.
If the user checks 'Australia' in in my list of countries (
checkbox_list), then the 'State - Australia' select box (
select_advanced) will appear.
'State - Australia'
select_advanced >> Advanced >> Conditional Logic - the settings in this section are as follow:
VISIBLE when ALL of these conditions match:
[field] [operator] [value]
FIELD: Unsure what to put... my 'checkbox_list' ID is
c_country and the individual input checkboxes all have the name
c_country in the admin edit screen source code
VALUE: Unsure whether to put "Australia" or 1/true (depends on earlier field/operator)
I have played around with a few options that I thought corresponded to the equivalent code from the docs but don't seem to be getting it right because the 'select_advanced' field is permanently visible right now.
Any guidance on the correct settings would be great. (Personally I would be comfortable coding it instead BUT I need to get familiar with the Builder interface so I can train my team.)
Hello, please try this:
Field: just use
contains. The value of a checkbox list is always an array. So it should "contains" your selection.
Value: the value of "Australia" that you set in the Options list of the
Please try and let me know how it goes.
Just gave that a shot (think it was one of the options I tried originally so good to know I was on the right track!) - but it does not seem to be working. 🙁
The State (Australia) field is showing regardless of any ticked/not ticked status in Country
Screenshot of settings and result: http://i65.tinypic.com/2zp38ro.png