diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index cebe79da30a..59296826a08 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -6122,7 +6122,7 @@ class Form
$prefixforautocompletemode = $objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
- $options=array();
+
if (!empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields (like societe, contact, ...)
{
$tmpfieldstoshow = '';