We have a rails 3.2.8 app with jquery autocomplete. The app should fire an event after user selects a customer name from the list (#invoice_customer_name_autocomplete). After selecting, an ajax change event is fired. That's all the app should do. However the following code does not do the job (error: "t.item.customer is undefined"). A user can not even select. The text box won't take customer name and the screen gets stuck:
//for autocomplete
$(function() {
  return $('#invoice_customer_name_autocomplete').autocomplete({
    minLength: 1,
    source: $('#invoice_customer_name_autocomplete').data('autocomplete-source'),
    select: function(event, ui) {
        $('#invoice_customer_name_autocomplete').val(ui.item.customer.name);
    },
  });
}); 
$(document).ready(function (){
    $('#invoice_customer_name_autocomplete').change(function (){
      //ajax call
      $.get(window.location, $('form').serialize(), null, "script");
      return false;
    });
});
If manually changing the customer name, the .change event will fire. However it does not fire after selecting. What's wrong with the code above?
UPDATE: If the select can trigger a change event on invoice_customer_name_autocomplete, then this is what we want. Tried the code below without success (no change event fired):
select: function(event, ui) {
   $(this).trigger('change');
}
 
     
    