diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 102f8a0037f..2ddc7125d4a 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -430,7 +430,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if ($forcefocus) $msg.= '.select2(\'focus\')'; $msg.= ';'."\n"; - if (count($events)) // If an array of js events to do were provided. + if (is_array($events) && count($events)) // If an array of js events to do were provided. { $msg.= ' jQuery("#'.$htmlname.'").change(function () {