@@ -, +, @@ --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js | 2 +- .../prog/en/includes/cateditor-widgets-marc21.inc | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js +++ a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js @@ -109,7 +109,7 @@ define( [ 'resources' ], function( Resources ) { createFromXML: function( resourceId ) { var widget = this; - Resources[resourceId].done( function( xml ) { + return Resources[resourceId].done( function( xml ) { $(widget.node).find('.widget-loading').remove(); var $matSelect = $('').appendTo(widget.node); var $contents = $('').appendTo(widget.node); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc @@ -243,7 +243,18 @@ require( [ 'koha-backend', 'widget', 'text-marc' ], function( KohaBackend, Widge return this.materialTypeMapping[this.text.substring(0, 1)]; }, postCreate: function( node, mark ) { - this.createFromXML( 'marc21/xml/007' ); + this.createFromXML( 'marc21/xml/007' ).then(() => { + $(this.node).find('.material-select').on('change', (e) => { + const keys = Object.keys(this.materialTypeMapping); + const k = keys.filter(k => this.materialTypeMapping[k] === $(e.target).val()); + this.setFixed(0, 1, k, '+input'); + + // FIXME There must be a better way to update display + const n = $(this.node).find('[name="f00"]'); + n.triggerHandler('focus'); + n.triggerHandler('blur'); + }); + }); } } ); --