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.