How to hide group field when post field is empty?

Support MB Conditional Logic How to hide group field when post field is empty?Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8391
    fexyfexy
    Participant

    Hello,

    What is the syntax for hiding a (group) field when another field (type='post') is null?

    I've tried several different variations like this on my group field:

    'hidden' => array('post', '!=', null),

    where 'post' is the metabox id of a sibling field. e.g.:

    array(
    'name' => __('Post'),
    'id' => 'post',
    'type' => 'post',
    'field_type' => 'select_advanced',
    'post_type' => array('recipe', 'post'),
    'placeholder' => 'Select post',
    'desc' => 'A recipe or post that appears in the list.'
    ),
    #8409
    Anh TranAnh Tran
    Keymaster

    Hi, the problem is your post field ID. On the editing screen, the #post is used for the post form, so you can't use ID post. You need to change the ID of the post field.

    Then, you can hide the group if the field is null with this condition:

    'hidden' => array( 'post2', '=', '' ), // post2 is post field ID.

    PS: Please renew your license to get updates of extensions and support.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.