- This topic has 6 replies, 2 voices, and was last updated 1 year, 4 months ago by .
-
Topic
-
Hello,
I try to have a conditionnal logic with fields in group with an option outside the group.
$meta_boxes[] = array( 'title' => __( 'Test', 'extensa' ), 'post_types' => array( 'extensa-venuerent' ), 'fields' => array( array( 'name' => 'Number', 'id' => "nbr", 'type' => 'select', 'options' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', ), ), array( 'name' => 'Title room 1', 'id' => "title_room_1", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '2'), 'name' => 'Title room 2', 'id' => "title_room_2", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '3'), 'name' => 'Title room 3', 'id' => "title_room_3", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '4'), 'name' => 'Title room 4', 'id' => "title_room_4", 'type' => 'text', ), array( 'name' => 'Items', 'id' => 'item', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( array( 'name' => 'Value room 1', 'id' => "value_room_1", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '2'), 'name' => 'Value room 2', 'id' => "value_room_2", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '3'), 'name' => 'Value room 3', 'id' => "value_room_3", 'type' => 'text', ), array( 'visible' => array("nbr", '>=', '4'), 'name' => 'Value room 4', 'id' => "value_room_4", 'type' => 'text', ), ), ), ), );
The fields outside the group with a “visible” option working great, if I choose nbr = 2, I only have title_room_1 and title_room_2 visible but in group, value_room_3 and value_room_4 are always visible.
I don’t know if my explanations are clear 🙁
Any clue ? It’s possible ?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.