Hi All,
here is a strange problem with autocomplete plugin.
in my application I have many autocompletes,
they all are written the same way and the backend side is also implemented the same way,
in some places I experience problems with them:
I type text, see the suggested results, select one of them,
and the result is not selected in the field.
The value is selected only if I choose the first result from the list,
with all the others the value is cleared.
Here is an example of my code:
<script type="text/javascript">
//<!--
$('#my_autocomplete_parent').ready(function() {
$('#my_autocomplete').autocomplete(
'http://my-action-url',
{
mustMatch: true,
minChars: 1,
scrollHeight: 100,
matchContains: true,
cacheLength: 1,
formatItem: function(data, i, n, value) {
value = eval("(" + value + ")");
var val = $('#my_autocomplete').val();
return value[1].replace(new RegExp(val, 'gi'), '<b>' + val + '</b>');
},
formatResult: function(data, value) {
value = eval("(" + value + ")");
return value[1];
}
}
).result(function(event, item) {
// some actions with the selected result
});
});
//-->
</script>
What do you think could cause such kind of behavior?
Thank you in advance,
Aram