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 798121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:55:12+00:00 2026-05-14T22:55:12+00:00

I use JQuery plugin autocomplete as a kind of dataset chooser. If the user

  • 0

I use JQuery plugin autocomplete as a kind of dataset chooser. If the user chooses a value from the autocomplete lookup, the database is queried for the matching dataset. If the user types in a new value, the user can enter a new dataset. An issue arises when the user types in an existing value rather than choosing it from the autocomplete lookup. When this is done, the autocomplete .result() method is not called and no dataset is retrieved. To fix this I added a .blur(function(){$(this).search();}); to the input element. This fixed the original problem.

Now I have the problem that .result() fires on selection from lookup AND on blur. I would like .result() to fire on selection from lookup OR on blur. How do I make that happen?

Here is my code:

$('#groupset').autocomplete('ajax/php/leeruns.php');
$('#groupset').result(
    function(event, data, formatted) {
        if(data){
            $('#groupsetdesc').val(formatted);
            groups.load(data[1]); //retrieve matching dataset
        } else {
            $('#groupsetdesc').val('');
        }
    }
).blur(function(){$(this).search();});
  • 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-05-14T22:55:13+00:00Added an answer on May 14, 2026 at 10:55 pm

    You could store the current value of data in a persistent variable called previous and not load the dataset if it is the same.

    var loaded_previous;
    $('#groupset').autocomplete('ajax/php/leeruns.php');
    $('#groupset').result(
    function(event, data, formatted) {
        if(data && data[1] != loaded_previous){
            loaded_previous = data[1];
            $('#groupsetdesc').val(formatted);
            groups.load(data[1]); //retrieve matching dataset
        } else {
            $('#groupsetdesc').val('');
        }
    }
    ).blur(function(){$(this).search();});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the jQuery Autocomplete plugin to display user info in the search box
i have i page where i use autocomplete jquery plugin. this might filter from
I am trying to use jquery autocomplete plugin, I want it to suggest ItemCodes
I'm struggling with the following problem. I use the jQuery autocomplete plugin to get
I'm trying to use the autocomplete plugin for jQuery (this one http://docs.jquery.com/Plugins/Autocomplete ). My
I want to use autocomplete for jQuery in Eclipse. The Aptana Plugin is installed:
I use jQuery Validation plugin to ensure what user entered positive cost_of_car in first
I have use rails3-jquery-autocomplete plugin and I am just wondering how can I use
Hey guys i want to use the jquery Autocomplete plugin and instead of separating
I want to use the jquery ui autocomplete plugin with 2 controls, so 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.