diff --git a/modules/pages-and-forms/pages/widgets.adoc b/modules/pages-and-forms/pages/widgets.adoc index e044bb49e1..eeeb3fa738 100644 --- a/modules/pages-and-forms/pages/widgets.adoc +++ b/modules/pages-and-forms/pages/widgets.adoc @@ -117,3 +117,36 @@ The URL points on a file without extension (e.g. \https://myhost/doc/sample) [.solution]#Possible solution# Make a custom widget from the File Viewer widget, and adapt the `controller.isPDF` or `controller.isImage`. -- + +[.troubleshooting-title] +=== Troubleshooting Auto Complete + +[.troubleshooting-section] +-- +[.symptom] +Autocomplete widget does not update its displayed value + +[.symptom-description] +Autocomplete widget does not update its displayed value when the value is changed by a variable. + +[.solution]#Possible solution# +Make a custom widget from the Autocomplete widget, and Update the controller by replacing the function that set the formatLabel as follows: + +[source,javascript] +---- + this.formatLabel = function ($model) { + if (this.selectedItem) { + let sel = this.selectedItem; + this.selectedItem = undefined; + return this.getLabel(sel); + } else { + if (typeof $model === 'object') { + return this.getLabel($model); + } else { + return $model; + } + } + }; +---- +-- +