mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-12 12:31:26 +01:00
FIX Do not lose selected id after ENTER the TAB on autocomplete
This commit is contained in:
@@ -63,10 +63,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
var autoselect = '.$autoselect.';
|
||||
var options = '.json_encode($ajaxoptions).';
|
||||
|
||||
/* Remove product id before select another product use keyup instead of change to avoid loosing the product id. This is needed only for select of predefined product */
|
||||
/* TODO Check if we can remove this */
|
||||
$("input#search_'.$htmlname.'").keydown(function() {
|
||||
/* Remove selected id as soon as we type or delete a char (it means old selection is wrong). Use keyup/down instead of change to avoid loosing the product id. This is needed only for select of predefined product */
|
||||
$("input#search_'.$htmlname.'").keydown(function(e) {
|
||||
if (e.keyCode != 9) /* If not "Tab" key */
|
||||
{
|
||||
console.log("Clear id previously selected for field '.$htmlname.'");
|
||||
$("#'.$htmlname.'").val("");
|
||||
}
|
||||
});
|
||||
|
||||
/* I disable this. A call to trigger is already done later into the select action of the autocomplete code
|
||||
|
||||
@@ -6378,7 +6378,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
|
||||
|
||||
|
||||
/**
|
||||
* Set focus onto field with selector
|
||||
* Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
|
||||
*
|
||||
* @param string $selector Selector ('#id' or 'input[name="ref"]') 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
|
||||
|
||||
Reference in New Issue
Block a user