diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 1eec9ff53be..21f6c427471 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2007-2012 Regis Houssin + * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +49,7 @@ function ajax_autocompleter($selected,$htmlname,$url,$option='',$minLength=2,$au if (this.value.length == 0) { jQuery("#search_'.$htmlname.'").val(""); - jQuery("#'.$htmlname.'").val(""); + jQuery("#'.$htmlname.'").val("").trigger("change"); } }); jQuery("input#search_'.$htmlname.'").autocomplete({ @@ -57,7 +58,7 @@ function ajax_autocompleter($selected,$htmlname,$url,$option='',$minLength=2,$au response( jQuery.map( data, function( item ) { if (autoselect == 1 && data.length == 1) { jQuery("#search_'.$htmlname.'").val(item.value); - jQuery("#'.$htmlname.'").val(item.key); + jQuery("#'.$htmlname.'").val(item.key).trigger("change"); } var label = item.label.toString(); return { label: label, value: item.value, id: item.key} @@ -67,7 +68,7 @@ function ajax_autocompleter($selected,$htmlname,$url,$option='',$minLength=2,$au dataType: "json", minLength: '.$minLength.', select: function( event, ui ) { - jQuery("#'.$htmlname.'").val(ui.item.id); + jQuery("#'.$htmlname.'").val(ui.item.id).trigger("change"); } }).data( "autocomplete" )._renderItem = function( ul, item ) { return jQuery( "
  • " )