not empty

Support MB Conditional Logic not empty

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #38207
    Ole PoetterOle Poetter
    Participant

    Hi,

    maybe I have overseen it, but is there a operatur for "not empty".
    I want to display a field if another filed is not empty.

    Kind regards,
    Ole

    #38213
    Long NguyenLong Nguyen
    Moderator

    Hi Ole,

    You can use the operator "not equal to" != and assign the field ID to an empty value like this

    'visible' => [ 'field_id', '!=', '' ],

    that means "not empty".

    #38215
    Ole PoetterOle Poetter
    Participant

    Hi Long,

    thank you, but in the MB Builder it doesn't seem to work.
    Can you try out please.
    Kind regards,
    Ole

    #38221
    Long NguyenLong Nguyen
    Moderator

    Hi Ole,

    It works correctly on my demo site, here is the screenshot in the builder https://imgur.com/6bDowIu

    #38233
    Ole PoetterOle Poetter
    Participant

    Hi Long,

    thanks for testing.

    Could it be that, that the conditional logic not working for a field in the admin column?

    (I am trying to achieve the following: In my CPT I have, among other fields, a field "internal message". The user can fill this field on frontend submission. If this field is not empty I would like to see a custom html field in admin column).

    Kind regards,
    Ole

    #38242
    Long NguyenLong Nguyen
    Moderator

    Hi Ole,

    The conditional logic does not work with admin columns, it is just the JS code to show/hide elements on a page (display none). If you want to customize the field value in the admin column, please follow this topic
    https://support.metabox.io/topic/icons-instead-of-values-to-indicate-a-confirmed-account-as-a-user-admin-column/#post-36979

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