Menu

autocomplete delay

Help
Tajny
2006-04-30
2013-04-10
  • Tajny

    Tajny - 2006-04-30

    Hi , how can i put delay on autocomplete when entering keys ? for example, to execute autocomplete after 1 second from last key pressed ?

    Thanks in advance
    Paul

     
    • Scott Noyes

      Scott Noyes - 2006-07-18

      Here's how I did it for ajaxtags-1.1.5:

      Edit file phpAjaxTags/js/ajaxtags-1.1.5.js
      c. line 716, following the line

          sourceElemChanged: function(e) {

      add the following:

          if ( this.timer != null )
              clearTimeout(this.timer);
          var thisObj = this;

      c. line 760, change the line

              this.sendRequest();

      to

              this.timer = setTimeout(function() { thisObj.sendRequest(); }, 1000)

       
      • Scott Noyes

        Scott Noyes - 2006-07-18

        Forgot one line for the above.  In the Autocomplete initialize section, c. line 668, following the line

        this.attachBehaviors(this.options.sourceElem, this.options.eventType, this.sourceElemChanged, this);

        add the line

        this.timer = null;

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.