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

  • Home
  • SEARCH
  • 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 3481986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:30:28+00:00 2026-05-18T10:30:28+00:00

I have a textbox with remote datasource for autocomplete(jquery) [not the plugin, the original

  • 0

I have a textbox with remote datasource for autocomplete(jquery) [not the plugin, the original one shown in jquery ui demos ]
How do I make sure user typed only what was in one of autocomplete suggestions and nothing of his own ?

  • 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-18T10:30:28+00:00Added an answer on May 18, 2026 at 10:30 am

    The question is lacking specifics, but I will assume you mean validate on the client side since you referred explicitly to the auto complete plugin. This answer will have two parts. The first is the original answer, assuming one autocomplete plugin. The second is revised based on updates to the question.

    1) Using http://docs.jquery.com/Plugins/Autocomplete

    The best solution for this is the “mustMatch” option. Here is the API documentation.

    If set to true, the autocompleter will only allow results that are presented by the backend. Note that illegal values result in an empty input box.

    You should be able to use it in this way:

    $("selector").autocomplete("url", {"mustMatch": true});
    

    You can also validate the user input in some way in the “result” event. Here is a link: http://docs.jquery.com/Plugins/Autocomplete/result .

    2) Using http://jqueryui.com/demos/autocomplete

    There is no mustMatch option here. You could extend the plugin, or you could add something similar to what I mentioned for the other autocomplete plugin. Use the “change” event.

    $( ".selector" ).autocomplete({
       change: function(event, ui) { ... }
    });
    

    If you were using an array as a datasource, this would be more efficient. Since you are using a remote data source you would need to do another final query using ui.item to validate the user value. You can then allow or deny the default behavior.

    In either case, the input should still be validated in some way on the server side. This is out of the scope of jQuery plugins.

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

Sidebar

Related Questions

Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote
I have a textbox bound to jQuery UI's autocomplete. When the user selects an
I have form autocomplete code that executes when value changes in one textbox. It
Desktop window application. I have textbox in which user give values in numbers. what
I have a textbox user control and when I double click, it adds the
I have an application all done in WPF, using MvvM/Prism/Unity and Remote as datasource.
I have an application with a lot of TextBox controls that use autocomplete. Each
I have textbox which should be used to send formatted text to remote application,
I am using jQuery Validate to make sure an entered report number is valid
I have a textbox with a RegularExpressionValidator. I want to require the user to

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.