diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 82a6dadcfb8..824d326883d 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -48,8 +48,9 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt var options = '.json_encode($ajaxoptions).'; // Remove product id before select another product - $("input#search_'.$htmlname.'").change(function() { - $("#'.$htmlname.'").val("").trigger("change"); + // use keyup instead change to avoid loosing the product id + $("input#search_'.$htmlname.'").keyup(function() { + $("#'.$htmlname.'").val("").trigger("change"); }); // Check when keyup $("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() { @@ -163,7 +164,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt }).data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
" ) .data( "item.autocomplete", item ) - .append( \'\' + item.label + "" ) + .append( \'\' + item.label + "" ) .appendTo(ul); }; });'; diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 17da725a80d..5b611768119 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -1,7 +1,7 @@ - * Copyright (C) 2010-2011 Laurent Destailleur