Portal : Autocomplete bug with IE9 in forms

SVN:trunk[4424]
This commit is contained in:
Guillaume Lajarige
2016-09-29 10:16:30 +00:00
parent b7d101cdfb
commit 88eece7188

View File

@@ -245,6 +245,9 @@ EOF
} }
}); });
// This check is only for IE9... Otherwise the widget is duplicated on the field causing misbehaviour.
if($('#$sAutocompleteFieldId').typeahead('val') === undefined)
{
$('#$sAutocompleteFieldId').typeahead({ $('#$sAutocompleteFieldId').typeahead({
hint: true, hint: true,
hightlight: true, hightlight: true,
@@ -262,6 +265,7 @@ EOF
}) })
.off('typeahead:select').on('typeahead:select', function(oEvent, oSuggestion){ .off('typeahead:select').on('typeahead:select', function(oEvent, oSuggestion){
$('#{$this->oField->GetGlobalId()}').val(oSuggestion.id); $('#{$this->oField->GetGlobalId()}').val(oSuggestion.id);
$('#{$sAutocompleteFieldId}').val(oSuggestion.name);
// Triggering set_current_value event // Triggering set_current_value event
var oValue = {}; var oValue = {};
oValue[oSuggestion.id] = oSuggestion.name; oValue[oSuggestion.id] = oSuggestion.name;
@@ -277,6 +281,7 @@ EOF
{ {
bFound = true; bFound = true;
$('#{$this->oField->GetGlobalId()}').val(oDatums[i].id); $('#{$this->oField->GetGlobalId()}').val(oDatums[i].id);
$('#{$sAutocompleteFieldId}').val(oDatums[i].name);
break; break;
} }
} }
@@ -287,6 +292,7 @@ EOF
$('#{$sAutocompleteFieldId}').val(''); $('#{$sAutocompleteFieldId}').val('');
} }
}); });
}
EOF EOF
); );
} }