We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22448
    • 241 Posts
    Hey all,

    i’m having a funky problem with AjaxSearch.
    It seems that AjaxSearch is having a conflict with MooTabs, but only in IE.

    If i remove MooTabs everything works fine. If I add it back in IE7 and IE6 through "Invalid argument" and "Object doesn’t support this property or method" errors with bogus line numbers. FF and Safari work fine.

    I looked into the page source and noticed that AjaxSearch automatically inserted ajaxSearch,js and a some init javascript as the last lines before </head>. So i modified AjaxSearch code to stop if from including it automatically and did it manually instead making sure that ajaxSearch.js is included before mootabs.js. That didn’t work.

    Any suggestions or ideas would be much appreciated.
      • 27708 MODX Staff
      • 2,502 Posts
      Look at the AjaxSearch Parameters: &addJscript, &jScript. You should be able to sort things out.

      Cheers,

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 22448
        • 241 Posts
        Thanks Jay,

        but i did that.
        here’s my call to AjaxSearch: [!AjaxSearch?&addJscript=`0`!]

        and i even modified the default.config.php file to set addJscript to 0, but for some reason it was still adding it. So i finally commented out that code in ajaxSearch.class.inc.php. That solved that.

        Didn’t solve the conflict with MooTabs though.
          • 27708 MODX Staff
          • 2,502 Posts
          Is this: [!AjaxSearch?&addJscript=`0`!] really your call? Sometimes the lack of a space between the initial question mark and the first ampersand will end up causing the parser to ignore the parameter.

          If you have still got ajaxsearch’s js loading after that I would be surprised you could comment out the regClientScript line from the Ajaxsearch.Class.

          If you are running into conflicts with the tabs it may be a namespace issue or CSS issue.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 18640
            • 9 Posts
            We’re also having a similar problem;
            We are using the drop down menu and the ajaxsearch on the same site and somewhere the two are conflicting. As you can see we’ve directed the search results to a different page ’8’ and this works correctly....until we add in the necessary mootools.js for the modx drop down menu. Once we do this the search results appear in a drop down style instead of going to the results page as they did before. Is there a way of preventing the AjaxSearch from using the mootools?.

            [[AjaxSearch? &AS_landing=`8` &moreResultsPage=`8` &showMoreResults=`1` &addJscript=`0` &extract=`0` &AS_showResults=`0`]]

              • 25663 MODX Staff
              • 12,272 Posts
              See if your page has mootools registering twice in the header. If so, disable registering mootools for one of your snippets.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 18640
                • 9 Posts
                We are linking to the mootools and dropdown javascript files just for the drop down menu;

                <script src="manager/media/script/mootools/mootools.js" type="text/javascript"></script>
                <script src="assets/templates/modxhost/drop_down_menu.js" type="text/javascript"></script>

                But when we add this (for the drop down to work) it then affects the search function.

                Without this, the search results are displayed on a new page which is what we need it to do. When we add in the js file, the search results appear below the search box which is not required.

                See the effect at http://www.ics-software.co.uk/index.php

                So, how do we tell the Ajax Search to ignore the mootools function whilst still allowing the dropdown menu to use mootools?

                Thanks