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.