diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index d8283a4da57..90c987298f5 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -135,6 +135,8 @@ class FormProjets require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + if (empty($htmlid)) $htmlid = $htmlname; + $out=''; $outarray=array(); @@ -175,14 +177,14 @@ class FormProjets if (! empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus,'resolve',$htmlid); + $comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus); $out.=$comboenhancement; $nodatarole=($comboenhancement?' data-role="none"':''); $minmax='minwidth100 maxwidth300'; } if (empty($option_only)) { - $out.= ''; } if (!empty($show_empty)) { $out.= ''; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index d593e279178..68e3f079361 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -357,14 +357,12 @@ function ajax_dialog($title,$message,$w=350,$h=150) * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete * @param int $forcefocus Force focus on field * @param string $widthTypeOfAutocomplete 'resolve' or 'off' - * @param int $htmlid Html id to use instead of htmlname * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. */ -function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve',$htmlid='') +function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve') { global $conf; - - if (empty($htmlid)) $htmlid = $htmlname; + if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen) if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile. if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; @@ -373,10 +371,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; $tmpplugin='select2'; - $msg=' + $msg='