Skip to content

Commit

Permalink
Fix auto focus on module page
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 16, 2017
1 parent 549bb2c commit b228fe6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion htdocs/admin/modules.php
Expand Up @@ -430,6 +430,8 @@

if ($mode == 'common')
{
dol_set_focus('#search_keyword');

print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
Expand All @@ -441,7 +443,7 @@

$moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" id="search_keyword" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
$moreforfilter.= '</div>';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -6089,12 +6089,12 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
/**
* Set focus onto field with selector
*
* @param string $selector Selector ('#id')
* @param string $selector Selector ('#id') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @return string HTML code to set focus
*/
function dol_set_focus($selector)
{
print '<!-- Set focus onto a specific field -->'."\n";
print "\n".'<!-- Set focus onto a specific field -->'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.$selector.'").focus(); });</script>'."\n";
}

Expand Down

0 comments on commit b228fe6

Please sign in to comment.