We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26868
    • 15 Posts
    Great job, thank you !!

    Quote from: rthrash at Jan 23, 2007, 06:54 AM

    Hi Kyle... got the updated AjaxSearch.php file (adding "as." to the "resultClass" on line 121, but I’m still not getting any results in either Fx or Safari.

    Had the same problem. I think it comes from the
    require_once(MODX_MANAGER_PATH . '/includes/protect.inc.php');

    in the beginning of AjaxSearch.php

    In my modx I do not have any protect.inc.php file...
    I do not now the utility of these file, but if you comment it, it works !

    In my config It was also required to change the line 77 in AjaxSearch.js to make it work from :
    $('ajaxSearch_input').addEvent('keyup', mainLoop());

    to :
    $('ajaxSearch_input').addEvent('keyup', mainLoop);


    Then, at the end of AjaxSearch.js, function : clearSearch() : when clicking on the close button, it did not hide the div and the button.
    Changed the function to make it work :
    function clearSearch() {
      if (liveSearch) {toggleImage($('searchClose'));}
      search_open = false;
      $('current-search-results').innerHTML = '';
      var o = $('ajaxSearch_output');
      o.style.display = 'none';
      $('ajaxSearch_input').value="";
      $('ajaxSearch_input').focus();
    }


    and Finaly, i think the first wait is a problem : for ex. if you quickly type a 4 caracters word in the field for the first time (when the result div is still hidden), first it display a result with the 3 first cars search and then after 1 or 2 seconds slides up and down the result to display the 4 cars search result.
    I got better result after moving is_searching=false; from resetForm() to doSearchResponse(), just before the wait before calling resetForm :
    function doSearchResponse(request) {
        var o = $('ajaxSearch_output');
        o.style.display = 'block';
        $('current-search-results').setHTML(decodeURIComponent(request));
    	newToggle.toggle();
    	is_searching = false;
    	setTimeout('resetForm()',1500);
    }
    
    function resetForm() {
        s = $('ajaxSearch_submit');
        s.disabled = false;
        toggleImage($('indicator'));
    }


    Regards,
    Tom.
      • 15987
      • 786 Posts
      Tom, great find.

      That line for protect.inc.php is from the upcoming 0.9.5.1, it is included to help protect from any external attacks. So until 0.9.5.1 is out that line needs commented out.

      I will look at the other changes you suggested and get those merged in. I may try to add a delay to the live search so it doesn’t start the search until a second or so after the last key was typed. Maybe that will fix that problem. Now if only I know an easy way to do that wink
        • 25663 MODX Staff
        • 12,272 Posts
        I made the updates per the above and can confirm they’re working. I think the reveal/hide animations might be a tiny bit slow for my preference, but it’s good new. However, Safari doesn’t like the AjaxSearch method but works happily without it. Any thoughts there?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 15987
          • 786 Posts
          I have updated the initial post with the mentioned fixes above. Also, I updated the way the live search works so it is better at detecting when a user is done typing. I think it works much better now. I also sped up the animations a little bit for you Ryan.

          If the zip I ahve included 2 javascript files. I ran AjaxSearch.js through a compressor to minimize the size of it, and then included the uncompressed version named AjaxSearch-uncompressed.js so you can see the code.

          Let me know if things are working better now.
            • 16429
            • 254 Posts
            grin
            just to see this topic in my "Unread replies"!
              kudo
              www.kudolink.com - webdesign (surprised?)

              [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
              • 27376
              • 576 Posts
              This new version is not working in Firefox OR Safari for me, It works flawlessly in IE7 (scary huh?).

              Any ideas? or help as to how to fix it, at least in Firefox?
                • 26868
                • 15 Posts
                1.6 works fine for me. The ’speed’ adjustements are better now.

                I’ve some problem with encoding (i’m using utf-8 for my whole site, but in the search result window it seems to be non utf-8.
                I will look at it.

                Thomas.
                  • 15987
                  • 786 Posts
                  sirlancealot,

                  can you give me some more info to help figure out the problem? is it throwing any js errors? does it do anything at all when you search? more info iw neede to help find the problem.
                    • 27376
                    • 576 Posts
                    Oops sorry, I was doing a quick post and forgot to edit it, here’s what happens:

                    Firefox 2.0.0.1
                    No JS errors popup (I’m using WebDeveloper Toolbar to detect/debug JS)
                    Both the Close and ’loading icon’ are visible on page load.
                    When I enter a search and press Enter, the page simply reloads, nothing else.
                    I’m using the snippet call [!AjaxSearch!], no parameters.

                    The previous version of AjaxSearch I was using (1.1) worked fine.

                    BTW, I’m using MODx 0.9.5.1 RC 1 (SVN 2256) but I don’t think that would have anything to do with it as It works fine in IE7 and all the JS scripts are including correctly.

                    Thanks for any assistance!
                      • 15987
                      • 786 Posts
                      do you have quickedit enabled? if the prototype/scriptaculous libraries are included it will cause conflicts with the script. is this a live site I can take a look at?