Conditional logic relation
Support › MB Conditional Logic › Conditional logic relation
- This topic has 3 replies, 2 voices, and was last updated 8 years, 10 months ago by
Tan Nguyen.
-
AuthorPosts
-
May 31, 2016 at 9:29 PM #3235
nicolas
ParticipantI have a
visible
condition with awhen
andor
relation.But the logic still seems to be a
when
andand
relation. Is this a know bug?I am also using tabs and groups together with this extension
June 5, 2016 at 12:16 AM #3295Tan Nguyen
ParticipantDear Nicolas,
Sorry for the long silence. Can you please post your code so I can check?
Tan
June 6, 2016 at 9:38 PM #3372nicolas
ParticipantThe argument is this
array( 'name' => esc_html__( 'Price', $plugin_name ), 'id' => "{$prefix}price", 'desc' => esc_html__( 'Input price without currency', $plugin_name ), 'type' => 'text', 'clone' => false, 'size' => 25, 'tab' => 'dish', // 'visible' => array( "{$prefix}menu_item_type", '!=', '0' ), 'hidden' => array( 'when' => array( array( "{$prefix}menu_item_type", 'not in', array( 'item_type_a_la_carte', 'item_type_table_hote', 'item_type_combo' ) ), array( "{$prefix}table_hote_price_radio", '=', 'no' ), ), 'relation' => 'or', ), ),
I tried the hidden logic but I have the same issue, it seems to be using an
and
logic.the
{$prefix}table_hote_price_radio
radio button is visible whenitem_type_table_hote
is selected. The{$prefix}price
textbox is supposed to show on all selection but it will show only onitem_type_table_hote
when{$prefix}table_hote_price_radio
is set toyes
June 10, 2016 at 9:38 PM #3431Tan Nguyen
ParticipantDear nicolas,
I've tested with my site and it works. This is my meta box:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) { $meta_boxes[] = array( 'id' => 'brand_product', 'title' => 'Brands and Products', 'post_types' => array( 'post', 'page' ), 'context' => 'normal', 'priority' => 'high', // Conditional Logic can be applied to Meta Box // In this example: Show this Meta Box by default. Hide it when post format is aside 'hidden' => array( 'post_format', 'aside' ), 'fields' => array( array( 'id' => 'brand', 'name' => 'Brand', 'desc' => 'Pick Your Favourite Brand', 'type' => 'select', 'options' => array( 'Apple' => 'Apple', 'Google' => 'Google', 'Microsoft' => 'Microsoft' ) ), array( 'id' => 'apple_products', 'name' => 'Which Apple product that you love?', 'type' => 'radio', 'options' => array( 'iPhone' => 'iPhone', 'iPad' => 'iPad', 'Macbook' => 'Macbook', 'iWatch' => 'iWatch' ), // Conditional Logic can applied to fields // In this example: Show this field by default, // hide it when user selected different value than 'Apple' on brand select field 'hidden' => array( 'brand', '!=', 'Apple' ) ), array( 'name' => 'Price', 'id' => "tan_price", 'desc' => 'Input price without currency', 'type' => 'text', 'clone' => false, 'size' => 25, 'tab' => 'dish', // 'visible' => array( "{$prefix}menu_item_type", '!=', '0' ), 'hidden' => array( 'when' => array( array( "brand", 'not in', array( 'Google', 'Microsoft' ) ), array( "post_category", 1 ), ), 'relation' => 'or' ), ), ) ); return $meta_boxes; } );
It hidden when either
brand
is Apple orpost_category
is 1.If this problem still persist, can you please send me your website credentials and FTP info via contact form so I can login your website to check?
Best regards,
Tan
-
AuthorPosts
- The topic ‘Conditional logic relation’ is closed to new replies.