Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:21:44+00:00 2026-06-13T10:21:44+00:00

We have a rails 3.2.8 app with jquery autocomplete. The app should fire an

  • 0

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');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:21:44+00:00Added an answer on June 13, 2026 at 10:21 am

    You may be using the jQuery Autocomplete plugin I can’t be sure, but you’re calling it the way you would call the jQuery UI autocomplete.

    In case you are using the first

    Suggestions:

    1. Use autocomplete in jQuery UI instead of the autocomplete plugin. The latter is deprecated.

    Using the correct framework here is a example of it working:
    jsFiddle

    It is no different from yours, so the thing is that you should log the ui object in order to understand why you are accessing a null object, the easiest way to do it is to log on console the whole object and watch it.

    console.log(ui)
    

    Edit:

    Regarding the onChange you may check this post: trigger onchange event manually

    Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that has an jquery ui autocomplete search input. It
I'm running a Rails 3 app, where I have a jQuery autocomplete box, which
I am trying to run jquery through a rails app. I have the edit
I have a rails app with Devise 1.4.9. Currently, it allows only users from
I have a simple rails app the displays a list of items and i
I have a problem with running js/jquery in my rails app. I have Ruby
I am using the jQuery Form Plugin with my Rails app. I have a
I am using the JQuery Autocomplete UI with my rails app and it is
Let's say I have a Rails 3 app that displays videos. The user can
I have jquery working on my Rails app using the gem 'jquery-rails' . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.