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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:43:44+00:00 2026-05-11T23:43:44+00:00

Drupal has a very well-architected, jQuery -based autocomplete.js . Usually, you don’t have to

  • 0

Drupal has a very well-architected, jQuery-based autocomplete.js. Usually, you don’t have to bother with it, since it’s configuration and execution is handled by the Drupal form API.

Now, I need a way to reconfigure it at runtime (with JavaScript, that is). I have a standard drop down select box with a text field next to it, and depending what option is selected in the select box, I need to call different URLs for autocompletion, and for one of the options, autocompletion should be disabled entirely. Is it possible to reconfigure the existing autocomplete instance, or will I have to somehow destroy and recreate?

  • 1 1 Answer
  • 1 View
  • 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-11T23:43:44+00:00Added an answer on May 11, 2026 at 11:43 pm

    Well, for reference, I’ve thrown together a hack that works, but if anyone can think of a better solution, I’d be happy to hear it.

    Drupal.behaviors.dingCampaignRules = function () {
      $('#campaign-rules')
        .find('.campaign-rule-wrap')
          .each(function (i) {
              var type = $(this).find('select').val();
    
              $(this).find('.form-text')
                // Remove the current autocomplete bindings.
                .unbind()
                // And remove the autocomplete class
                .removeClass('form-autocomplete')
              .end()
              .find('select:not(.dingcampaignrules-processed)')
                .addClass('dingcampaignrules-processed')
                .change(Drupal.behaviors.dingCampaignRules)
              .end();
    
              if (type == 'page' || type == 'library' || type == 'taxonomy') {
                $(this).find('input.autocomplete')
                  .removeClass('autocomplete-processed')
                  .val(Drupal.settings.dingCampaignRules.autocompleteUrl + type)
                .end()
                .find('.form-text')
                  .addClass('form-autocomplete');
                Drupal.behaviors.autocomplete(this);
              }
          });
    };
    

    This code comes from the ding_campaign module. Feel free to check out the code if you need to do something similar. It’s all GPL2.

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

Sidebar

Related Questions

In Drupal, there is a site I have to work on that has an
So I have this site here which has major performance issues. Scrolling is very
Drupal is very much a Do Everything CMS. There are modules that allow you
I have Drupal 5 site where a button is clicked and it calls a
I have a Drupal module page where I am populating a form with a
This may well be simple, but I'm new to Drupal. The organization I work
I have a client who has a sort of data warehouse stored in DB2.
I have a few Views on my Drupal 6 site which take care of
I have a Drupal 6 site where I've created a view that shows a
I am very green at Drupal and I would like to recreate a list

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.