Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic Hidden a group of metabox fields wiht a radio value of another metabox group

This topic contains 2 replies, has 2 voices, and was last updated by  proyectohappyweb@gmail.com 4 months, 2 weeks ago.

  • Creator
    Topic
  • #14353

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #14377

    Anh 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

    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 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.