We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16429
    • 254 Posts
    I was thinking about how to implement this snippet but with moo.fx (13kb) instead of prototype+scriptaculous (~150kb), but sincerely I haven’t a clue about how to do it.
      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]
      • 15987
      • 786 Posts
      That is on my list of things to do. I’m not sure I will do it before a whole rewrite of the search is done, so that all of a pages content is searched.
        • 16429
        • 254 Posts
        If you can tell me how the js is implemented I’ll help you with this thing.
          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]
          • 15987
          • 786 Posts
          Everything is handled in the file AjaxSearch.js

          Give it a look and you can see how everything works.
            • 16429
            • 254 Posts
            I’ve found a bug in version 1.1.

            in the snippet itself (not the included file) at lines 458-460 you read:
              $SearchForm .= '<label for="ajaxSearch_submit"><input id="ajaxSearch_submit" type="submit" name="sub" value="'.$searchButtonText.'" />';
              $SearchForm .= ($xhtmlStrict)? '</fieldset>' : '';
              $SearchForm .= '</label></form>'.$newline;
            

            It’s the code that outputs the search form: as you can read on the second line it does a check for the xhtmlStrict parameter (read the param explanation) to add (or not) the <fieldset> tag.
            But there’s a problem, the <label> is closed on the next line, after the </fieldset>!

            The correct code is:
              $SearchForm .= '<label for="ajaxSearch_submit"><input id="ajaxSearch_submit" type="submit" name="sub" value="'.$searchButtonText.'" /></label>';
              $SearchForm .= ($xhtmlStrict)? '</fieldset>' : '';
              $SearchForm .= '</form>'.$newline;
            
              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]
              • 25663 MODX Staff
              • 12,272 Posts
              Thanks for reporting this... Committing now.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 16429
                • 254 Posts
                Always glad to help anyone here.
                  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]
                  • 17895
                  • 209 Posts
                  Thanks for this MARVELOUS snippet... anyway, it can be useful to have other things to be set with parameters, as, for example, the text on the "Go" (I prefer "Search", for example) or the message "Please enter a search term to begin your search" (I prefer not to show anything).
                    Daniele "MadMage" Calisi
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    There is a section near the top of the snippet code, heavily commented, for editing these.
                      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
                      • 17895
                      • 209 Posts
                      Quote from: sottwell at Nov 11, 2006, 05:38 PM

                      There is a section near the top of the snippet code, heavily commented, for editing these.

                      ah yes... this is what I did... but any time I reinstall MODx, I need to re-change it... and it’s true also if I upgrade to another version of the snippet...

                      anyway... in general I do not think that editing the code is the best solution...
                        Daniele "MadMage" Calisi

                      This discussion is closed to further replies. Keep calm and carry on.