diff --git a/addressbook/templates/default/index.xet b/addressbook/templates/default/index.xet
index e927665cf0..5abe754f7c 100644
--- a/addressbook/templates/default/index.xet
+++ b/addressbook/templates/default/index.xet
@@ -154,7 +154,7 @@
-
+
diff --git a/api/js/etemplate/et2_widget_selectAccount.js b/api/js/etemplate/et2_widget_selectAccount.js
index e50fe03d39..8558bb9e12 100644
--- a/api/js/etemplate/et2_widget_selectAccount.js
+++ b/api/js/etemplate/et2_widget_selectAccount.js
@@ -661,8 +661,8 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
if (typeof _value == 'string' && _value.indexOf(',') > 0) {
_value = _value.split(',');
}
- // Don't bother to lookup if it's not an array, or a number
- if (typeof _value == 'object' || !isNaN(_value) && _value != "") {
+ // pass objects to link widget right away, as following code can't deal with objects
+ if (typeof _value == 'object') {
_super.prototype.set_value.call(this, _value);
// Don't make it look like a link though
jQuery('li', this.list).removeClass("et2_link et2_link_string")
@@ -674,10 +674,12 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
jQuery('li', this.list).removeClass("et2_link et2_link_string")
// No clicks either
.off();
+ var found = false;
if (this.options.select_options && !jQuery.isEmptyObject(this.options.select_options) || this.options.empty_label) {
if (!_value) {
// Empty label from selectbox
this.list.append("
" + this.options.empty_label + "
");
+ found = true;
}
else if (typeof _value == 'object') {
// An array with 0 / empty in it?
@@ -688,6 +690,7 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
}
else if (this.options.select_options[_value]) {
this.list.append("
" + this.options.select_options[_value] + "
");
+ found = true;
}
}
}
@@ -698,19 +701,28 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
search = [_value];
}
for (var j = 0; j < search.length; j++) {
- var found = false;
// Not having a value to look up causes an infinite loop
if (!search[j])
continue;
for (var i in this.options.select_options) {
if (this.options.select_options[i].value == search[j]) {
this.list.append("
" + this.options.select_options[i].label + "
");
+ found = true;
break;
}
}
}
}
}
+ // if nothing found in select-options let link widget try
+ if (!found && !isNaN(_value)) {
+ _super.prototype.set_value.call(this, _value);
+ // Don't make it look like a link though
+ jQuery('li', this.list).removeClass("et2_link et2_link_string")
+ // No clicks either
+ .off();
+ return;
+ }
};
et2_selectAccount_ro._attributes = {
"empty_label": {
diff --git a/api/js/etemplate/et2_widget_selectAccount.ts b/api/js/etemplate/et2_widget_selectAccount.ts
index e3ac4937a3..ed1d46d0ea 100644
--- a/api/js/etemplate/et2_widget_selectAccount.ts
+++ b/api/js/etemplate/et2_widget_selectAccount.ts
@@ -826,8 +826,8 @@ export class et2_selectAccount_ro extends et2_link_string
_value = _value.split(',');
}
- // Don't bother to lookup if it's not an array, or a number
- if(typeof _value == 'object' || !isNaN(_value) && _value != "")
+ // pass objects to link widget right away, as following code can't deal with objects
+ if (typeof _value == 'object')
{
super.set_value(_value);
// Don't make it look like a link though
@@ -842,12 +842,14 @@ export class et2_selectAccount_ro extends et2_link_string
// No clicks either
.off();
+ let found = false;
if(this.options.select_options && !jQuery.isEmptyObject(this.options.select_options) || this.options.empty_label)
{
if(!_value)
{
// Empty label from selectbox
this.list.append("
"+this.options.empty_label+"
");
+ found = true;
}
else if (typeof _value == 'object')
{
@@ -862,6 +864,7 @@ export class et2_selectAccount_ro extends et2_link_string
else if (this.options.select_options[_value])
{
this.list.append("
"+this.options.select_options[_value]+"
");
+ found = true;
}
}
}
@@ -875,8 +878,6 @@ export class et2_selectAccount_ro extends et2_link_string
}
for(let j = 0; j < search.length; j++)
{
- var found = false;
-
// Not having a value to look up causes an infinite loop
if(!search[j]) continue;
@@ -885,6 +886,7 @@ export class et2_selectAccount_ro extends et2_link_string
if(this.options.select_options[i].value == search[j])
{
this.list.append("
"+this.options.select_options[i].label+"
");
+ found = true;
break;
}
}
@@ -892,6 +894,16 @@ export class et2_selectAccount_ro extends et2_link_string
}
}
}
+ // if nothing found in select-options let link widget try
+ if(!found && !isNaN(_value))
+ {
+ super.set_value(_value);
+ // Don't make it look like a link though
+ jQuery('li',this.list).removeClass("et2_link et2_link_string")
+ // No clicks either
+ .off();
+ return;
+ }
}
}
et2_register_widget(et2_selectAccount_ro, ["select-account_ro"]);