This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new a7f5a03845 Improved: Make lookup's no result message not selectable
(#553)
a7f5a03845 is described below
commit a7f5a03845500a513897f7a8d815a48a447749f2
Author: Florian Motteau <[email protected]>
AuthorDate: Wed Oct 19 13:41:01 2022 +0200
Improved: Make lookup's no result message not selectable (#553)
---
.../webapp/common-theme/js/util/OfbizUtil.js | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
b/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
index 423621a668..031efd4bf0 100644
--- a/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
+++ b/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
@@ -967,13 +967,21 @@ function ajaxAutoCompleter(areaCsvString,
showDescription, defaultMinLength, def
});
},
select: function(event, ui){
- //jQuery("#" + areaArray[0]).html(ui.item);
- jQuery("#" + areaArray[0]).val(ui.item.value); // setting a
text field
- if (showDescription && (ui.item.value != undefined &&
ui.item.value != '')) {
- setLookDescription(areaArray[0], ui.item.label,
areaArray[2], formName, showDescription)
+ // search returned something
+ if(ui.item.id !== '') {
+ $(`#${areaArray[0]}`).val(ui.item.value);
+ if (showDescription && (ui.item.value != undefined &&
ui.item.value != '')) {
+ setLookDescription(areaArray[0], ui.item.label,
areaArray[2], formName, showDescription);
+ }
+ } else {
+ // empty the search input
+ $(`#${areaArray[0]}`).val('');
+ // cancel the selection (do not copy "no result found" in
the search field)
+ event.preventDefault();
}
}
});
+
if (showDescription) {
var lookupDescriptionLoader = new
lookupDescriptionLoaded(areaArray[i], areaArray[i + 1], areaArray[i + 2],
formName);
lookupDescriptionLoader.update();