diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php
index 990ab5ecc..e743d919d 100644
--- a/application/ui.extkeywidget.class.inc.php
+++ b/application/ui.extkeywidget.class.inc.php
@@ -226,7 +226,8 @@ class UIExtKeyWidget
while ($oObj = $oAllowedValues->Fetch()) {
$aOption = [];
$aOption['value'] = $oObj->GetKey();
- $aOption['label'] = $oObj->GetName();//.'';
+ $aOption['label'] = $oObj->GetName();
+ $aOption['search_label'] = utils::HtmlEntityDecode($oObj->GetName());
if (($oAllowedValues->Count() == 1) && ($bMandatory == 'true')) {
// When there is only once choice, select it by default
@@ -260,7 +261,7 @@ class UIExtKeyWidget
}
$sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_DECORATED;
$sHTMLValue .= "";
- $sJsonOptions = str_replace('\\', '\\\\', json_encode($aOptions));
+ $sJsonOptions = str_replace("'", "\'", str_replace('\\', '\\\\', json_encode($aOptions)));
$oPage->add_ready_script(
<<iId} = new ExtKeyWidget('{$this->iId}', '{$this->sTargetClass}', '$sFilter', '$sTitle', true, $sWizHelper, '{$this->sAttCode}', $sJSSearchMode, $sJSDoSearch);
diff --git a/js/extkeywidget.js b/js/extkeywidget.js
index 9bd485260..dc0b46ec1 100644
--- a/js/extkeywidget.js
+++ b/js/extkeywidget.js
@@ -58,6 +58,7 @@ Selectize.define('custom_itop', function(aOptions) {
original.apply(self);
}
})();
+
ManageScroll = function (self) {
let id = self.$input[0].id;
if (self.$input.scrollParent()[0].tagName != 'HTML') {
@@ -160,14 +161,14 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
},
valueField: 'value',
labelField: 'label',
- searchField: 'label',
+ searchField: 'search_label',
options: JSON.parse(options),
maxItems: 1,
copyClassesToDropdown: false,
inputClass: 'ibo-input ibo-input-select ibo-input-selectize',
// To avoid dropdown to be cut by the container's overflow hidden rule
dropdownParent: 'body',
- onDropdownOpen: function(oDropdownElem){
+ onDropdownOpen: function (oDropdownElem) {
me.UpdateDropdownPosition(this.$control, oDropdownElem);
},
});