Clonable fields within clonable fields are not working with certain fields

Support MB Group Clonable fields within clonable fields are not working with certain fields

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6083
    nppnpp
    Participant

    https://github.com/rilwis/meta-box/issues/1132

    We need to get this looked at.

    TL;DR something goes nuts when storing values of a cloned group with clones, specifically using 'date' field. It works for the first, doesn't work for the rest. Best guess is that group.js needs some fixing or special case date scenarios. I'm guessing some id's are being lost somehow. Pure speculation though but the "html" seems to be created correctly, in some cases. Upon saving data gets lost or scrambled up.

    Edit: this is with v 1.2.3, going to try 1.2.4 and see if that fixes it.

    #6084
    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.

    #6137
    Anh TranAnh Tran
    Keymaster

    Just updated the plugin with the fix you provided :).

    Thanks for your contribution.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Clonable fields within clonable fields are not working with certain fields’ is closed to new replies.