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.
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.
If you can tell me how the js is implemented I’ll help you with this thing.
Everything is handled in the file AjaxSearch.js
Give it a look and you can see how everything works.
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;
-
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
Always glad to help anyone here.
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
-
☆ A M B ☆
- 24,524 Posts
There is a section near the top of the snippet code, heavily commented, for editing these.