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
  • 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-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

Ask A Question

Stats

  • Questions 192k
  • Answers 192k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $(function () // when DOM is ready for manipulation, do:… May 12, 2026 at 6:18 pm
  • Editorial Team
    Editorial Team added an answer Install an SSH client on you iPhone, e.g. pTerm. I… May 12, 2026 at 6:18 pm
  • Editorial Team
    Editorial Team added an answer Liferay is Java Portal framework that runs in a Java… May 12, 2026 at 6:18 pm

Related Questions

Drupal has a very well-architected, jQuery -based autocomplete.js . Usually, you don't have to
A site I'm creating for a customer in D6 has various images overlaying parts
I'm trying to get Drupal 6 to reverse the order in which the nodes
I've just got a site running nicely with the whole site running through SSL,
There are a ton of PHP frameworks out there (i.e. Zend, Seagull, Symfony, CodeIgniter,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.