Hide/Show fields on select type
Support › MB Conditional Logic › Hide/Show fields on select type
- This topic has 7 replies, 2 voices, and was last updated 5 years, 10 months ago by
Anh Tran.
-
AuthorPosts
-
April 3, 2019 at 10:14 PM #14050
dave.meta
ParticipantHello !
I need your help because I try to hide and show some fields.
When I select carousel or gallery, the group 'modules_slides' show, but I want for example the field id 'module_slide_legend' show only if the 'module_type' is 'carousel'. The condition doesn't work now, but I think before it worked.Can someone help me ?
Thanks.
array( 'name' => 'Slides', 'id' => PREFIX . 'module_slides', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'visible' => array( 'when' => array( array(PREFIX . 'module_type', '=', 'carousel'), array(PREFIX . 'module_type', '=', 'gallery'), ), 'relation' => 'or', ),
array( 'name' => 'Légende', 'id' => PREFIX . 'module_slide_legend', 'type' => 'wysiwyg', 'options' => array( 'media_buttons' => false, 'wpautop' => false, 'textarea_rows' => '5', ), // 'visible' => array( // 'when' => array( // array(PREFIX . 'module_type', '=', 'carousel'), // ), // 'relation' => 'or', // ), ),
April 4, 2019 at 6:04 PM #14063Anh Tran
KeymasterHi Dave,
The condition looks simple and should work. Do you put them in different groups?
April 4, 2019 at 7:59 PM #14068dave.meta
ParticipantHello !
Thank you for the response. At the bottom you can see how I set the condition, I have a clone group call 'modules' and in this group I can choose if I want to have a carousel, a image... and if I choose 'carousel' or 'gallery', I can set a 'module_slides' in where I want the field 'module_slide_legend' display only if I choose 'carousel', I comment the condition because it doesn't work and the field were not displayed.
https://ghostbin.com/paste/7j38q
Thanks
April 7, 2019 at 6:56 AM #14085Anh Tran
KeymasterHi Dave,
I see the problem. At the moment, the conditions works only if both fields are in a same group clone. I see the module type is outside of the group where the editor belongs to. So it’s not working.
April 17, 2019 at 2:32 PM #14186dave.meta
ParticipantHello !
Thanks for the response.
And it's a bug or it's normal ?
April 18, 2019 at 5:20 PM #14199Anh Tran
KeymasterHi Dave,
It's normal. Since when you have multiple clones, it's impossible to know which clone is affected by the value of the selected field.
June 12, 2019 at 7:14 PM #14945dave.meta
ParticipantHello !
Thanks for the response.
Since the last response, I try a lot of fixes, the first one is I try to downgrade the Metabox Conditionnal Logic from 1.6.5 to 1.5.5, and the fields which has dissapear came back, but the admin page is very very slow..
Now I use the version 1.6.5 and the WP admin page is faster, but the fields has dissapear again..
The problem is the condition in a clone of a clone is not reading by the Metabox Conditionnal Logic, so I comment some lines like this in all my clone of a clone.
I didn't understand why it works on 1.5.5 and not in 1.6.5 ?
If you can enlighten me in this bug ?
Thanks.
array( 'name' => 'CTA lien PDF (uniq. pushs avec lien)', 'id' => PREFIX . 'module_push_link_pdf', 'type' => 'file_advanced', 'class' => 'warning-red', // 'visible' => array( // 'when' => array( // array(PREFIX . 'module_type', '=', 'pushs-link'), // ), // 'relation' => 'or', // ), ),
June 13, 2019 at 9:47 AM #14955Anh Tran
KeymasterHi Dave,
I've just push a fix for MB Conditional Logic extension. Now that works for elements outside cloneable groups.
The update for Meta Box AIO will come later.
-
AuthorPosts
- You must be logged in to reply to this topic.