Fix: uniformize function (ready)
This commit is contained in:
parent
9c330663c7
commit
cf9072349a
@ -147,11 +147,23 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
|||||||
//alert(fields + " " + length);
|
//alert(fields + " " + length);
|
||||||
|
|
||||||
jQuery("input#'.$htmlname.'").autocomplete({
|
jQuery("input#'.$htmlname.'").autocomplete({
|
||||||
source: function( request, response ) {
|
dataType: "json",
|
||||||
jQuery.getJSON( "'.$url.($option?'?'.$option:'').'", { '.$htmlname.': request.term }, response );
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
|
source: function( request, response ) {
|
||||||
|
jQuery.getJSON( "'.$url.($option?'?'.$option:'').'", { '.$htmlname.': request.term }, function(data){
|
||||||
|
response( jQuery.map( data, function( item ) {
|
||||||
|
if (data.length == 1) {
|
||||||
|
jQuery("#'.$htmlname.'").val(item.value);
|
||||||
|
for (i=0;i<length;i++) {
|
||||||
|
if (item[fields[i]]) {
|
||||||
|
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
},
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
for (i=0;i<length;i++) {
|
for (i=0;i<length;i++) {
|
||||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user