diff --git a/api/js/etemplate/et2_widget_link.js b/api/js/etemplate/et2_widget_link.js index 3828f899e0..a8add15f53 100644 --- a/api/js/etemplate/et2_widget_link.js +++ b/api/js/etemplate/et2_widget_link.js @@ -619,7 +619,9 @@ var et2_link_entry = /** @class */ (function (_super) { select: function (event, item) { event.data = self; // Correct changed value from server - item.item.value = item.item.value.trim(); + if (item.item.value) { + item.item.value = ("" + item.item.value).trim(); + } self.select(event, item); return false; }, diff --git a/api/js/etemplate/et2_widget_link.ts b/api/js/etemplate/et2_widget_link.ts index 80df9adb15..1c9fd959b0 100644 --- a/api/js/etemplate/et2_widget_link.ts +++ b/api/js/etemplate/et2_widget_link.ts @@ -804,7 +804,10 @@ export class et2_link_entry extends et2_inputWidget { event.data = self; // Correct changed value from server - item.item.value = item.item.value.trim(); + if(item.item.value) + { + item.item.value = (""+item.item.value).trim(); + } self.select(event,item); return false; }, diff --git a/api/js/etemplate/et2_widget_selectAccount.js b/api/js/etemplate/et2_widget_selectAccount.js index 3971e09324..8d537335b2 100644 --- a/api/js/etemplate/et2_widget_selectAccount.js +++ b/api/js/etemplate/et2_widget_selectAccount.js @@ -326,10 +326,10 @@ var et2_selectAccount = /** @class */ (function (_super) { // Add to list ids.push(id); // Make sure option is there - if (!widget.options.multiple && jQuery('input[id$="_opt_' + id + '"]', widget.multiOptions).length == 0) { + if (widget.options.multiple && jQuery('input[id$="_opt_' + id + '"]', widget.multiOptions).length == 0) { widget._appendMultiOption(id, jQuery('label', this).text()); } - else if (widget.options.multiple && jQuery('option[value="' + id + '"]', widget.node).length == 0) { + else if (!widget.options.multiple && jQuery('option[value="' + id + '"]', widget.node).length == 0) { widget._appendOptionElement(id, jQuery('label', this).text()); } }); @@ -395,7 +395,7 @@ var et2_selectAccount = /** @class */ (function (_super) { self._appendOptionElement(selected.item.value, selected.item.label); } self.set_value(selected.item.value); - if (self.dialog) { + if (self.dialog && self.dialog.div) { self.dialog.div.dialog("close"); } // Fire change event diff --git a/api/js/etemplate/et2_widget_selectAccount.ts b/api/js/etemplate/et2_widget_selectAccount.ts index f57d6556ea..13ce0c0434 100644 --- a/api/js/etemplate/et2_widget_selectAccount.ts +++ b/api/js/etemplate/et2_widget_selectAccount.ts @@ -405,11 +405,11 @@ export class et2_selectAccount extends et2_selectbox ids.push(id); // Make sure option is there - if(!widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0) + if(widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0) { widget._appendMultiOption(id,jQuery('label',this).text()); } - else if (widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0) + else if (!widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0) { widget._appendOptionElement(id,jQuery('label',this).text()); } @@ -480,7 +480,7 @@ export class et2_selectAccount extends et2_selectbox return true; }, 'select'( e, selected) - { + { // Make sure option is there var already_there = false; var last_key = null; @@ -495,7 +495,7 @@ export class et2_selectAccount extends et2_selectbox self._appendOptionElement(selected.item.value, selected.item.label); } self.set_value(selected.item.value); - if(self.dialog) + if(self.dialog && self.dialog.div) { self.dialog.div.dialog("close"); }