Support Forum » User Profile

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: Conditional logic not working with clones in groups #8549
    nppnpp
    Participant

    Thank 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.

    in reply to: Conditional logic not working with clones in groups #8542
    nppnpp
    Participant

    All right, I replaced the contents of js/clone.js in 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 are radio inputs, 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!

    in reply to: Conditional logic not working with clones in groups #8532
    nppnpp
    Participant

    Sorry 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=sharing

    As you can see, as soon as I select "+ Add more", the previous is "forgotten".

    in reply to: Conditional logic not working with clones in groups #8514
    nppnpp
    Participant

    Any updates on this issue? If you need me to try something, let me know.

    in reply to: Conditional logic not working with clones in groups #8485
    nppnpp
    Participant

    Hmm 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.

    in reply to: Conditional logic not working with clones in groups #8484
    nppnpp
    Participant

    Yes 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=sharing

    in reply to: Visibility functionality broken #8473
    nppnpp
    Participant

    I 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.

    in reply to: Conditional Logic not hidden in collapsible group. #8460
    nppnpp
    Participant

    I believe https://support.metabox.io/topic/conditional-logic-not-working-with-clones-in-groups/ is related to this issue as well

    in reply to: Cloneable group inheriting values from previous group #7281
    nppnpp
    Participant

    Same 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.

    nppnpp
    Participant
    	group.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.

Viewing 10 posts - 1 through 10 (of 10 total)