Forum Replies Created
-
AuthorPosts
-
February 13, 2018 at 10:31 PM in reply to: Conditional logic not working with clones in groups #8549
npp
ParticipantThank you. I somehow missed that entirely and that works splendidly!
Now everything works as I expected it to work. Thank you Anh for the support. Appreciate it! There's a bug though, not related to this but something I discovered while trying the fixes regarding this thread.
If you have an image module, upload an image, click the little 'pen' to edit the selected image and select 'delete permanently' the JS will throw an exception and the media.window or whatnot will bug out a bit and won't actually remove the image from the selection although it has been removed from the media library.
Just a smaller annoyance but still, worth mentioning.
npp
ParticipantAll right, I replaced the contents of
js/clone.jsin the main MetaBox plugin. So far, it does work in regards to not *forgetting* the previous box radio settings when cloning. However, one small issue still remains - it ignored the 'std' for the radio on clone.So in this case, I have
'std' => 'img'and it's only respected for the first page load but not on clone. Seeing as they areradioinputs, having one pre-filled is a pretty common feat in my opinion. It's either Image or Video, must be one or the other.Other than that, it works. Thank you!
npp
ParticipantSorry to say, it still doesn't work as expected. The field is hidden now, and visible as it should be. But it still *forgets* when you hit clone.
This is still the code used to test with:
$prefix = '_something_'; $meta_boxes[] = array( 'title' => 'Box settings', 'post_types' => 'page', 'fields' => array( array( 'id' => $prefix . 'test', 'name' => 'Image or video boxes', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => 'Box #{#}', 'save_state' => true, 'fields' => array( array( 'name' => 'Image or video?', 'id' => $prefix . 'type123', 'type' => 'radio', 'options' => [ 'img' => 'Image', 'vid' => 'Video', ], 'std' => 'img', 'inline' => false, ), array( 'id' => $prefix . 'image', 'name' => 'Choose image', 'type' => 'image_advanced', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'image_size' => 'thumbnail', 'visible' => [ $prefix . 'type123', 'img' ], ), array( 'id' => $prefix . 'video', 'name' => 'Choose video', 'type' => 'video', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'visible' => [ $prefix . 'type123', 'vid' ], ), ), ), ), );This is a short video showcasing the issue at hand:
https://drive.google.com/file/d/1YKq_43Gz6hjl9FDMFI5PnTC20Z-fNtJd/view?usp=sharingAs you can see, as soon as I select "+ Add more", the previous is "forgotten".
npp
ParticipantAny updates on this issue? If you need me to try something, let me know.
npp
ParticipantHmm can't edit the post. So the code is currently:
$prefix = '_something_'; $meta_boxes[] = array( 'title' => 'Box settings', 'post_types' => 'page', 'fields' => array( array( 'id' => $prefix . 'test', 'name' => 'Image or video boxes', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => 'Box #{#}', 'save_state' => true, 'fields' => array( array( 'name' => 'Image or video?', 'id' => $prefix . 'type123', 'type' => 'radio', 'options' => [ 'img' => 'Image', 'vid' => 'Video', ], 'std' => 'img', 'inline' => false, ), array( 'id' => $prefix . 'image', 'name' => 'Choose image', 'type' => 'image_advanced', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'image_size' => 'thumbnail', 'visible' => [ $prefix . 'type123', 'img' ], // <-- not working ), array( 'id' => $prefix . 'video', 'name' => 'Choose video', 'type' => 'video', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'visible' => [ $prefix . 'type123', 'vid' ], // <-- not working ), ), ), ), );And the above video applies. As you can see, it does not function as intended. It resets the value when you clone as for radio, it shows image selection by default outside collapse although being in collapsed state by default.. Yeah I can't get this to work.
npp
ParticipantYes I understand what you're saying. But I have tried, and it is the same result. Try this code:
$prefix = '_something_'; $meta_boxes[] = array( 'title' => 'Box settings', 'post_types' => 'page', 'fields' => array( array( 'id' => $prefix . 'test', 'name' => 'Image or video boxes', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => 'Box #{#}', 'save_state' => true, 'fields' => array( array( 'name' => 'Image or video?', 'id' => $prefix . 'type123', 'type' => 'radio', 'options' => [ 'img' => 'Image', 'vid' => 'Video', ], 'std' => 'img', 'inline' => false, ), array( 'id' => $prefix . 'image', 'name' => 'Choose an image', 'type' => 'image_advanced', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'image_size' => 'thumbnail', 'visible' => [ $prefix . 'type', 'img' ], // <-- not working ), array( 'id' => $prefix . 'video', 'name' => 'Choose video', 'type' => 'video', 'force_delete' => false, 'max_file_uploads' => 1, 'max_status' => false, 'visible' => [ $prefix . 'type', 'vid' ], // <-- not working ), ), ), ), );That should work, but it doesn't. The reason I didn't have a $prefix in there was because it's a cloned group, it should *know* better. _something_test[0][type] isn't post_type. But okay, if we don't want to add logic to handle that, at least it should work with prefixed fields. But it doesn't.
Problem 1 "sort of" disappears, the 'default_state' doesn't work and one of the two alternatives are visible on page load until you expand. Then it disappears. Then if you select "Image", set an image, and "clone", the setting is lost (see problem #2).
Don't know what to do. I'll show you what happens here:
https://drive.google.com/file/d/18lzVdnsD8FrKVUlYgJzDNcF1v4lUSVB7/view?usp=sharingnpp
ParticipantI wonder if this is the same as https://support.metabox.io/topic/conditional-logic-not-working-with-clones-in-groups/ - where do we find 1.5.5 to try if it solves the issue? Seems related but can't be sure.
npp
ParticipantI believe https://support.metabox.io/topic/conditional-logic-not-working-with-clones-in-groups/ is related to this issue as well
November 4, 2017 at 7:02 PM in reply to: Cloneable group inheriting values from previous group #7281npp
ParticipantSame issue here. It should reset the "conditions" set and duplicate the fields rather than "cloning" them. Also, the standard "field" param 'add_button' does not work for most/all fields.
Say you have an image uploader and limit it to 1 upload, you'd want the button to say "Select an image", one would think 'add_button' => 'Select an image' should work in the field of the image uploader but it doesn't. But the "topmost" field works, so in my "group" and I have it cloneable, where this issue of this topic comes in, the button text can be changed.
Iffy behaviour thought I should put it in here while you're looking at the other issue we have.
June 16, 2017 at 4:00 PM in reply to: Clonable fields within clonable fields are not working with certain fields #6084npp
Participantgroup.toggle.updateTitle = function ( index, element ) { var $group = $( element ), $title = $group.find( '> .rwmb-group-title, > .rwmb-input > .rwmb-group-title' ), options = $title.data( 'options' ), content; if( 'undefined' == typeof options ) return; if ( 'text' === options.type ) { content = options.content.replace( '{#}', index ); } if ( 'field' === options.type ) { var fieldId = $title.data( 'options' ).field, $field = $group.find( ':input[name*="[' + fieldId + ']"]' ); content = $field.val(); if ( $field.is( 'select' ) ) { content = $field.find( 'option:selected' ).text(); } // Update title when field's value is changed. if ( ! $field.data( 'update-group-title' ) ) { $field.on( 'keyup change', _.debounce( function () { group.toggle.updateTitle( 0, element ); }, 250 ) ).data( 'update-group-title', true ); } } $title.text( content ); };Initial testing of 1.2.4 seems to have solved this issue, however not without adding
if( 'undefined' == typeof options ) return;
As I got 'type' undefined on some fields. Adding above in seems to solve that.
-
AuthorPosts