0 Replies Latest reply on Mar 3, 2014 5:17 PM by Photoshare

    Delay for <CFDIV search@keyup>

    Photoshare Level 1

      I've added an AutoSuggest script to my site that offers suggestions as the user types their search keyword(s).   The script works great except that it performs a search with every keystroke.   I have spent the past 3 days trying out different jquery scripts that will for when a user stops typing before sending the search request, but I cannot get any of them to work correctly.  Some prevent the search from being sent until the user clicks OUT of the search box, but I need a script that will work when the user stops typing for (xxx ms).     I have include my code below in hopes someone might be able to help.


      BTW:  I do not know jquery or javascript much at all.  I can often look at a script and know what to edit, but that's about it. Even this script for the AUTOSUGGEST was from a post I found online.




      <style type="text/css">


          input.autosuggestinput{    z-index:1000000;}

          div.autosuggestcontainer {position:relative;top:.3em;width:100%;background-color:#FFFFFF;font-size:11px;font-famil y:Arial, Helvetica, sans-serif}






      <cfform mehod="post" enctype="multipart/form-data" action="searchresult.cfm" style="margin:0px;">

      <input type="text" name="search" autocomplete="off" id="out">







      <div id="criteriaautosuggest" class="autosuggest">

      <div id="criteriacontainer" class="autosuggestcontainer">

          <cfdiv bind="url:#request.app.storepath#/include/search/getresults.cfm?search={search@keyup}" bindOnLoad = "true" style="background-color:##D2E8E8"/>







      <cfset url.search = left(url.search,100)>

      <cfset url.search = rereplacenocase(url.search,"[()]","","all")>

      <cfif #len(trim(url.search))# is "0"><cfset url.search = "xyz0123"></cfif>









      <CFOUTPUT QUERY="getresults2">

           <div style="padding:4px; border:1px solid black;">

                <a href="#path#/detail.cfm?pid=#key#">#title#</a>




      I am hoping someone has a simple script that will allow a delay before the search request is sent to the GETRESULTS.CFM page and returned into the CFDIV.


      Thank you,