This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch release22.01 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push: new cc646de260 Improved: Make lookup's no result message not selectable (#553) cc646de260 is described below commit cc646de2601dce99f34dbedf4fcfc7e8e680aed7 Author: Florian Motteau <florian.mott...@nereide.fr> AuthorDate: Wed Oct 19 13:41:01 2022 +0200 Improved: Make lookup's no result message not selectable (#553) --- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index 3921c75275..a56289725d 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -953,13 +953,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();