diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index acf2f788802..c3ed5a4aacc 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -81,6 +81,7 @@ else $showtitlebefore = GETPOST('showtitlebefore','int'); include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; + $i=0; $accesskeyalreadyassigned=array(); foreach($arrayresult as $key => $val) { @@ -94,7 +95,9 @@ else $accesskey=$val['label'][0]; $accesskeyalreadyassigned[$accesskey]=$accesskey; } - $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore); + $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore, ($i>0?0:1)); + + $i++; } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9afed25286c..27e3b84b1de 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1740,7 +1740,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) { $urltosearch=DOL_URL_ROOT.'/core/search_page.php?showtitlebefore=1'; - $searchform='
'; + $searchform=''; } elseif ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { @@ -1935,9 +1935,10 @@ function getHelpParamFor($helppagename,$langs) * @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page * @param string $img Image to use * @param string $showtitlebefore Show title before input text instead of into placeholder. This can be set when output is dedicated for text browsers. + * @param string $autofocus Set autofocus on field * @return string */ -function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='',$img='', $showtitlebefore=0) +function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='',$img='', $showtitlebefore=0, $autofocus=0) { global $conf,$langs,$user; @@ -1951,6 +1952,7 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret.=' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"'; $ret.=($accesskey?' accesskey="'.$accesskey.'"':''); $ret.=' placeholder="'.strip_tags($title).'"'; + $ret.=($autofocus?' autofocus':''); $ret.=' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />'; //$ret.=''; $ret.='