We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25046
    • 194 Posts
    I am using AjaxSearch 1.5 and have a couple of problems: (Otherwise this is a very nice feature)

    The output of the search form does not include the id of the search form (ajaxSearch_form) and therefore I have to style it separately using a DIV. Is this a bug or am I doing something wrong? The other style id’s for the input box and the button get outputted correctly.

    My search form works properly but doesn’t seem to be able to find 3 character words (like "ceo"). No problem with 4 characters and above, though. Any idea what this is all about?

    Thanks!
    • Hmm... I’ve got it with no problem:
      <form id="ajaxSearch_form" action="index.php?id=8" method="post">

      Using this snippet call:
      [!AjaxSearch? ajaxSearch=`1` &AS_landing=`8` &moreResultsPage=`8` &showMoreResults=`1` &addJscript=`0` &extract=`0` &AS_showResults=`0`!]


      MySQL does not accept search terms of less than 4 characters.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 25046
        • 194 Posts
        Thanks.

        I found a $minChars setting in the AjaxSearch snippet. I have set this to $minChars = 3 and now it finds all the three letter words I want it to. This seemed too easy, so there must be a catch?

        Here is the snippet call I used:
        [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`59` &AS_showResults=`0` &extract=`1`!]

        And here is what it produced (ignore the SearchForm div wrapper which I had to add:

        <div id="SearchForm">
        <form action="searchresults.html" method="post">
        <label for="ajaxSearch_input">
        <input id="ajaxSearch_input" type="text" name="search" value="Search here..." onfocus="this.value= (this.value==’Search here...’)? ’’ : this.value ;" />
        </label>
        <label for="ajaxSearch_submit">
        <input id="ajaxSearch_submit" type="submit" name="sub" value="Go!" />
        </label>
        </form>
        </div>