Hidden a group of metabox fields wiht a radio value of another metabox group

Support MB Conditional Logic Hidden a group of metabox fields wiht a radio value of another metabox group

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14353
    proyectohappyweb@gmail.com[email protected]
    Participant

    Hello,

    I have two metabox:

    First metabox 'metabox_id_A' wiht a radio field 'radio_field_id' and the values 'radio_1' and 'radio_2'.

    Another metabox 'metabox_id_B' with some text fields 'text_field_1', 'text_field_2', 'text_field_3', 'text_field_4','map_field'...

    It's posible to hidden all the fields of' metabox_id_B' if is select the 'radio_1' of the 'metabox_id_A' ?

    I try this i the 'metabox_id_A':
    'hidden' => array( 'metabox_id_A', '=', 'radio_1' ),

    And it run well in the back office, but NOT run well in the front office...

    If I put the hidden in each field of 'text_field_1', 'text_field_2',..... it run well both, back and front office.

    Also, don't know if is the best way do this, because in this case, I only have one field in 'metabox_id_A'.

    Thanks,
    Sergio

    #14377
    Anh TranAnh Tran
    Keymaster

    Hi Sergio,

    There are 2 ways to do that as you already described in your question:

    1. Set the rule for each field in the meta box B, or
    2. Set the rule for the whole meta box B.

    I think the 2nd solution is better and cleaner. This rule should be put in the settings of the meta box B:

    'hidden' => array( 'radio_field_id', '=, 'radio_1' ),

    The rule should specify the field ID, not the meta box ID (since the meta box is just a wrap of fields).

    #14391
    proyectohappyweb@gmail.com[email protected]
    Participant

    Hello,

    This second method, Set the rule for the whole meta box B, don't do nothing for me, not run in front office... In the back office it run well.

    To run well in the front office I have to do the option 1, Set the rule for each field in the meta box.

    Don't know if the problem is only for me...

    Thanks

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