[jQuery] Re: Autosuggest breaks in ie7/8
Want to let you now it's fixed and it works great now under ie7/8. And want to thank especially MorningZ for your help. There was one little error in your fix. And I found nice little debug tool for JSON - http://www.jsonlint.com After adding the array then imploding in the php code it worked great!. Final: { results: [ { postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com; }, { postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com; } --- Comma needed to be removed to work with IE7/8 ], paging: { start_idx:1, end_idx:5, total:5, current:1, pages:1, has_next:false, has_prev:false } } On Dec 23, 8:00 am, Michael Geary m...@mg.to wrote: BTW, just to commiserate, you're not the only one who's ever posted incorrect information here. Want to hear a whopper I posted a couple of years ago? Someone was asking how to change the title in the browser window, and I told them that they couldn't: You only get one chance at setting the title, because you can only have one title tag in a document, and once the page is loaded you can't add another title tag. Lucky for the OP, someone followed up with a comment to the effect of, Dude! Ever hear of document.title? :-) -Mike On Tue, Dec 22, 2009 at 8:48 PM, Michael Geary m...@mg.to wrote: I intended no offense, MorningZ, but suggesting that changing a parameter name from 'row' to 'ThisRow' may somehow fix an IE problem isn't helpful in the slightest. It's simply incorrect. It won't fix the problem, and it's only a distraction from finding the real issue. 'row' isn't a reserved word in IE or in any other browser: http://www.google.com/search?q=javascript+reserved+words
[jQuery] Re: Autosuggest breaks in ie7/8
The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL: http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q = $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else { clearTimeout(AJAX_PENDING_TIMER); CURRENT_PAGE = 1; AJAX_PENDING_TIMER = setTimeout(PerformLiveSearch(),300); } }); $(#livesearch_result_close_link).click(function() { HideLiveSearch(); }); } function NextPage(p) { if(p['has_next']) { AJAX_IS_RUNNING = false; CURRENT_PAGE++; PerformLiveSearch(); }} function PrevPage(p) { if(p['has_prev']) { AJAX_IS_RUNNING = false; CURRENT_PAGE--; PerformLiveSearch(); } } function ShowLoaders() { $('#ajaxloader').fadeIn('fast'); if( $('#livesearch').css('display') == 'block' ) { var h = $('#livesearch').height() - 5; var w = $('#livesearch').width() - 45; $('#loader_div').width(w); $('#loader_div').height(h); $('#loader_div p').css('margin-top',(h/2)+20); $('#loader_div').fadeIn('fast'); } } function HideLoaders() { $('#ajaxloader').fadeOut('fast'); $('#loader_div').hide(); } var AJAX_IS_RUNNING = false; function PerformLiveSearch() { if(AJAX_IS_RUNNING == true) { return; } var query = $(#search_val); var q_val = (query.val() query.val() != SEARCH_BOX_DEFAULT_TEXT) ? query.val() : ''; if(q_val == '') { return; } AJAX_IS_RUNNING = true; $.ajax({ url: './search', data: { query: q_val, output: 'json', page: CURRENT_PAGE, limit: CURRENT_LIMIT }, type: 'get', timeout: '5000', dataType: 'json', beforeSend: function() { // Before send request // Show the loader AJAX_IS_RUNNING = true; ShowLoaders(); }, complete: function() { // When Sent request // Hide the loader AJAX_IS_RUNNING = false; HideLoaders(); }, success: function(data, textStatus) { AJAX_IS_RUNNING = false; HideLoaders(); $('#livesearch').slideDown(); // clear the results $(.livesearch_results dd).remove(); var resultsNav = $('.livesearch_results dt'); if( data['results'].length ) { // add the new results (in reverse since the // append inserts right after the
[jQuery] Re: Autosuggest breaks in ie7/8
that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q = $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else { clearTimeout(AJAX_PENDING_TIMER); CURRENT_PAGE = 1; AJAX_PENDING_TIMER = setTimeout(PerformLiveSearch(),300); } }); $(#livesearch_result_close_link).click(function() { HideLiveSearch(); }); } function NextPage(p) { if(p['has_next']) { AJAX_IS_RUNNING = false; CURRENT_PAGE++; PerformLiveSearch(); }} function PrevPage(p) { if(p['has_prev']) { AJAX_IS_RUNNING = false; CURRENT_PAGE--; PerformLiveSearch(); } } function ShowLoaders() { $('#ajaxloader').fadeIn('fast'); if( $('#livesearch').css('display') == 'block' ) { var h = $('#livesearch').height() - 5; var w = $('#livesearch').width() - 45; $('#loader_div').width(w); $('#loader_div').height(h); $('#loader_div p').css('margin-top',(h/2)+20); $('#loader_div').fadeIn('fast'); } } function HideLoaders() { $('#ajaxloader').fadeOut('fast'); $('#loader_div').hide(); } var AJAX_IS_RUNNING = false; function PerformLiveSearch() { if(AJAX_IS_RUNNING == true) { return; } var query = $(#search_val); var q_val = (query.val() query.val() != SEARCH_BOX_DEFAULT_TEXT) ? query.val() : ''; if(q_val == '') { return; } AJAX_IS_RUNNING = true; $.ajax({ url: './search', data: { query: q_val, output: 'json', page: CURRENT_PAGE, limit: CURRENT_LIMIT }, type: 'get', timeout: '5000', dataType: 'json', beforeSend: function() { // Before send request // Show the loader AJAX_IS_RUNNING = true; ShowLoaders(); }, complete: function() { // When Sent request // Hide the loader AJAX_IS_RUNNING = false; HideLoaders(); }, success: function(data, textStatus) { AJAX_IS_RUNNING = false; HideLoaders(); $('#livesearch').slideDown(); // clear the results $(.livesearch_results dd).remove();
[jQuery] Re: Autosuggest breaks in ie7/8
Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q = $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else { clearTimeout(AJAX_PENDING_TIMER); CURRENT_PAGE = 1; AJAX_PENDING_TIMER = setTimeout(PerformLiveSearch(),300); } }); $(#livesearch_result_close_link).click(function() { HideLiveSearch(); }); } function NextPage(p) { if(p['has_next']) { AJAX_IS_RUNNING = false; CURRENT_PAGE++; PerformLiveSearch(); }} function PrevPage(p) { if(p['has_prev']) { AJAX_IS_RUNNING = false; CURRENT_PAGE--; PerformLiveSearch(); } } function ShowLoaders() { $('#ajaxloader').fadeIn('fast'); if( $('#livesearch').css('display') == 'block' ) { var h = $('#livesearch').height() - 5; var w = $('#livesearch').width() - 45; $('#loader_div').width(w); $('#loader_div').height(h); $('#loader_div p').css('margin-top',(h/2)+20); $('#loader_div').fadeIn('fast'); } } function HideLoaders() { $('#ajaxloader').fadeOut('fast'); $('#loader_div').hide(); } var AJAX_IS_RUNNING = false; function PerformLiveSearch() { if(AJAX_IS_RUNNING == true) { return; } var query = $(#search_val); var q_val = (query.val() query.val() != SEARCH_BOX_DEFAULT_TEXT) ? query.val() : ''; if(q_val == '') { return; } AJAX_IS_RUNNING = true; $.ajax({ url: './search', data: { query: q_val, output: 'json', page: CURRENT_PAGE, limit: CURRENT_LIMIT }, type: 'get', timeout: '5000', dataType: 'json', beforeSend: function() { // Before send request // Show the loader AJAX_IS_RUNNING = true; ShowLoaders(); }, complete: function() { // When Sent request // Hide the loader AJAX_IS_RUNNING = false; HideLoaders();
[jQuery] Re: Autosuggest breaks in ie7/8
IE has a really hard time with reserved words used as function names and/or properties try changing row to something else, even Row would be different enough, as IE *might* be thinking you mean a table row so instead of function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } try function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } if that doesn't work, see if the value passed in is indeed a JSON object function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } if that doesn't work then you are not passing an object into the function (perhaps it's a string?) On Dec 22, 8:35 pm, GJK gerlofva...@gmail.com wrote: Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q = $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else { clearTimeout(AJAX_PENDING_TIMER); CURRENT_PAGE = 1; AJAX_PENDING_TIMER = setTimeout(PerformLiveSearch(),300); } }); $(#livesearch_result_close_link).click(function() { HideLiveSearch(); }); } function NextPage(p) { if(p['has_next']) { AJAX_IS_RUNNING = false; CURRENT_PAGE++; PerformLiveSearch(); }} function PrevPage(p) { if(p['has_prev']) { AJAX_IS_RUNNING = false; CURRENT_PAGE--; PerformLiveSearch(); } } function ShowLoaders() { $('#ajaxloader').fadeIn('fast'); if( $('#livesearch').css('display') == 'block' ) { var h = $('#livesearch').height() - 5; var w = $('#livesearch').width() - 45; $('#loader_div').width(w); $('#loader_div').height(h); $('#loader_div p').css('margin-top',(h/2)+20); $('#loader_div').fadeIn('fast'); } } function HideLoaders() { $('#ajaxloader').fadeOut('fast'); $('#loader_div').hide(); } var AJAX_IS_RUNNING = false; function PerformLiveSearch() {
[jQuery] Re: Autosuggest breaks in ie7/8
Thank you MorningZ for your nice reply. I have tested this with ie8, function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } Still got 'link' is null or not an object. Than I tested this: function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } I'm getting output with firefox, but not with inet explorer. I'm my firefox i loaded the site and checked the output with firebug: GET http://localhost/search?query=knmi+output=jsonpage=1limit=5 200 OK 3ms {results:[{ postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com;, } ,{ postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com;, } ,], paging:{ start_idx:1, end_idx:5, total:5, current:1, pages:1, has_next:false, has_prev:false, } } On Dec 23, 3:50 am, MorningZ morni...@gmail.com wrote: IE has a really hard time with reserved words used as function names and/or properties try changing row to something else, even Row would be different enough, as IE *might* be thinking you mean a table row so instead of function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } try function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } if that doesn't work, see if the value passed in is indeed a JSON object function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } if that doesn't work then you are not passing an object into the function (perhaps it's a string?) On Dec 22, 8:35 pm, GJK gerlofva...@gmail.com wrote: Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() {
Re: [jQuery] Re: Autosuggest breaks in ie7/8
Sorry, but that's not right at all. There is no problem with using 'row' as a function parameter name in IE. We're veering into Cargo Cult Programming here, but it's not your fault, MorningZ. The problem is that we can't see the actual code that's going wrong, so we're all reduced to guessing. GJK, could you please post a link to a test page that demonstrates the problem? That's the only way we can see the real issue and offer useful advice. -Mike On Tue, Dec 22, 2009 at 6:50 PM, MorningZ morni...@gmail.com wrote: IE has a really hard time with reserved words used as function names and/or properties try changing row to something else, even Row would be different enough, as IE *might* be thinking you mean a table row so instead of function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } try function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } if that doesn't work, see if the value passed in is indeed a JSON object function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } if that doesn't work then you are not passing an object into the function (perhaps it's a string?) On Dec 22, 8:35 pm, GJK gerlofva...@gmail.com wrote: Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q= $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else { clearTimeout(AJAX_PENDING_TIMER); CURRENT_PAGE = 1; AJAX_PENDING_TIMER = setTimeout(PerformLiveSearch(),300); } }); $(#livesearch_result_close_link).click(function() { HideLiveSearch(); }); } function NextPage(p) { if(p['has_next']) { AJAX_IS_RUNNING = false; CURRENT_PAGE++; PerformLiveSearch(); }} function PrevPage(p) { if(p['has_prev']) { AJAX_IS_RUNNING = false; CURRENT_PAGE--; PerformLiveSearch(); } } function ShowLoaders() {
[jQuery] Re: Autosuggest breaks in ie7/8
Sorry, but that's not right at all My point was that IE does run into issue when it comes to reserved words, which row is and as you can (or obviously can't) tell from my reply, you're right, i was just taking some stabs in the dark to at least make an attempt to help. i don't think i needed a whole paragraph dedicated to me in your reply because i tried to help... lots of people makes posts on here that it's broke without any indication or why or how it could have happened... but if some of us didn't at least try to help, then this mailing list would be practically nothing but topics started with replies of post code/ link whatever i suppose On Dec 22, 11:04 pm, Michael Geary m...@mg.to wrote: Sorry, but that's not right at all. There is no problem with using 'row' as a function parameter name in IE. We're veering into Cargo Cult Programming here, but it's not your fault, MorningZ. The problem is that we can't see the actual code that's going wrong, so we're all reduced to guessing. GJK, could you please post a link to a test page that demonstrates the problem? That's the only way we can see the real issue and offer useful advice. -Mike On Tue, Dec 22, 2009 at 6:50 PM, MorningZ morni...@gmail.com wrote: IE has a really hard time with reserved words used as function names and/or properties try changing row to something else, even Row would be different enough, as IE *might* be thinking you mean a table row so instead of function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } try function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } if that doesn't work, see if the value passed in is indeed a JSON object function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } if that doesn't work then you are not passing an object into the function (perhaps it's a string?) On Dec 22, 8:35 pm, GJK gerlofva...@gmail.com wrote: Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error: - Line: 158 Character: 2 Code: 0 Error Message: 'fghds' is null or not an object URL:http://localhost.com/js/search.js - This is the jquery script: - var SEARCH_BOX_DEFAULT_TEXT = 'Enter the keywords:'; var AJAX_PENDING_TIMER; var CURRENT_PAGE = 1; var CURRENT_LIMIT = 5; function init() { var sTextBox = $(#search_val); sTextBox.focus(function() { if(this.value == SEARCH_BOX_DEFAULT_TEXT) { this.value = ''; } }); sTextBox.blur(function() { if(this.value == '') { this.value = SEARCH_BOX_DEFAULT_TEXT; } }); sTextBox.blur(); sTextBox.keyup(function() { var q = $(#search_val).val(); if( q == SEARCH_BOX_DEFAULT_TEXT || q == '' || q == undefined || q.length=3) { HideLiveSearch(); } else {
[jQuery] Re: Autosuggest breaks in ie7/8
btw, i realize i am mistaken, as rows is a property, not row my bad... i tried though
[jQuery] Re: Autosuggest breaks in ie7/8
your JSON {results:[{ postid:697, summary:boddytest, title:testtitlehere, link:http:// testlink.com, } ,{ postid:697, summary:boddytest, title:testtitlehere, link:http:// testlink.com, } ,], paging:{ start_idx:1, end_idx:5, total:5, current:1, pages:1, has_next:false, has_prev:false, } } * tsk tsk * see how you have trailing commas after the last key/value pairs? IE = handles that poorly { results: [ { postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com; }, { postid:697, summary:boddytest, title:testtitlehere, link:http://testlink.com; }, ], paging: { start_idx:1, end_idx:5, total:5, current:1, pages:1, has_next:false, has_prev:false } } that would/should be JSON that IE can handle.
Re: [jQuery] Re: Autosuggest breaks in ie7/8
I intended no offense, MorningZ, but suggesting that changing a parameter name from 'row' to 'ThisRow' may somehow fix an IE problem isn't helpful in the slightest. It's simply incorrect. It won't fix the problem, and it's only a distraction from finding the real issue. 'row' isn't a reserved word in IE or in any other browser: http://www.google.com/search?q=javascript+reserved+words We could all think of any number of possible code changes that might or might not have anything to do with the actual problem. It wouldn't be helpful if everyone jumped in suggesting those changes. I wonder if you were thinking of the issue where IE creates a read-only property on the window object for every element ID on your page? That *can* be a real problem. But it only affects global variable names (i.e. window properties), not local variables or parameter names. Now I see from your followup message that you *have* identified the real problem (or at least *a* real problem). Now that truly is helpful, and I'm sure that GJK will be grateful that you've found it. So keep up the good work! :-) -Mike On Tue, Dec 22, 2009 at 8:26 PM, MorningZ morni...@gmail.com wrote: Sorry, but that's not right at all My point was that IE does run into issue when it comes to reserved words, which row is and as you can (or obviously can't) tell from my reply, you're right, i was just taking some stabs in the dark to at least make an attempt to help. i don't think i needed a whole paragraph dedicated to me in your reply because i tried to help... lots of people makes posts on here that it's broke without any indication or why or how it could have happened... but if some of us didn't at least try to help, then this mailing list would be practically nothing but topics started with replies of post code/ link whatever i suppose On Dec 22, 11:04 pm, Michael Geary m...@mg.to wrote: Sorry, but that's not right at all. There is no problem with using 'row' as a function parameter name in IE. We're veering into Cargo Cult Programming here, but it's not your fault, MorningZ. The problem is that we can't see the actual code that's going wrong, so we're all reduced to guessing. GJK, could you please post a link to a test page that demonstrates the problem? That's the only way we can see the real issue and offer useful advice. -Mike On Tue, Dec 22, 2009 at 6:50 PM, MorningZ morni...@gmail.com wrote: IE has a really hard time with reserved words used as function names and/or properties try changing row to something else, even Row would be different enough, as IE *might* be thinking you mean a table row so instead of function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } try function DisplayResult(ThisRow) { var output = 'dd id='; output += 'a href=' + ThisRow['link'] + ''; output += 'p'; output += 'b' + ThisRow['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } if that doesn't work, see if the value passed in is indeed a JSON object function DisplayResult(row) { $.each(row, function(key, val) { alert(key + : + val); }); } if that doesn't work then you are not passing an object into the function (perhaps it's a string?) On Dec 22, 8:35 pm, GJK gerlofva...@gmail.com wrote: Ok thank you, Why does this code work in Firefox etc. And not in internet explorer 7/8. And how to fix this for internet explorer? Greatly appreciate it! On Dec 23, 1:38 am, MorningZ morni...@gmail.com wrote: that means that title is not a valid property of the row object On Dec 22, 5:46 pm, GJK gerlofva...@gmail.com wrote: The error was wrong, the good one from internet explorer: - Line: 158 Character: 2 Code: 0 Error Message: 'title' is null or not an object URL:http://localhost.com/js/search.js And it's coming from this function: - function DisplayResult(row) { var output = 'dd id='; output += 'a href=' + row['link'] + ''; output += 'p'; output += 'b' + row['title'] + '/b'; output += row['summary']; output += '/p/a/dd'; return output; } On Dec 22, 9:53 pm, GJK gerlofva...@gmail.com wrote: Hello, I got this code for search auto suggest and everything works fine in Firefox, Chrome, Opera etc. But it breaks in internet explorer 7 and 8. I get this error:
Re: [jQuery] Re: Autosuggest breaks in ie7/8
BTW, just to commiserate, you're not the only one who's ever posted incorrect information here. Want to hear a whopper I posted a couple of years ago? Someone was asking how to change the title in the browser window, and I told them that they couldn't: You only get one chance at setting the title, because you can only have one title tag in a document, and once the page is loaded you can't add another title tag. Lucky for the OP, someone followed up with a comment to the effect of, Dude! Ever hear of document.title? :-) -Mike On Tue, Dec 22, 2009 at 8:48 PM, Michael Geary m...@mg.to wrote: I intended no offense, MorningZ, but suggesting that changing a parameter name from 'row' to 'ThisRow' may somehow fix an IE problem isn't helpful in the slightest. It's simply incorrect. It won't fix the problem, and it's only a distraction from finding the real issue. 'row' isn't a reserved word in IE or in any other browser: http://www.google.com/search?q=javascript+reserved+words
[jQuery] Re: Autosuggest based dropdown selection plugin
On 6/27/09 5:11 AM, bharani kumar bharanikumariyer...@gmail.com wrote: Hi all , I used the auto suggest / complete in my lot of projects , But this is some what different , I need the auto suggest plugin , that auto suggest must work based on the dropdown selection , Assume if select the airport , the airports data only populate or show in the suggest , not an alll , -- Autosuggest airport seaport stations how about putting the value of the select in extraParams and then have your backend for the usual autocomplete plugin return only relevant suggestions?
[jQuery] Re: autosuggest help
You can't query a MySQL database from JavaScript. There has to be some serverside script to execute a query and return the results. Thats what search.php is supposed to do. Jörn On Tue, Sep 23, 2008 at 8:51 PM, allan2008 [EMAIL PROTECTED] wrote: Hello. I'm trying to figure out the bassistance jQuery plugin: Autocomplete. From what I can gather if I want to get results remotely they must be held in an external php file (ie. search.phps). Is it possible for the plugin to get results directly from a mysql table? If so how can I get it to search through the table? Thanks.
[jQuery] Re: autosuggest help
Here just a little example how you can do this: // index.htm ... script $(#autocomplete).autocomplete(search.php); /script ... // search.php ?php mysql_connect(localhost, user, pass); mysql_select_db(mySearchTable); $query = mysql_query(SELECT * FROM T_Search WHERE name LIKE ' . $_REQUEST[q] . %'); while ($row = mysql_fetch_assoc($query)) { echo $row[name] . |; echo $row[firstname] . \n; } ? that's all. On 24 Sep., 09:53, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can't query a MySQL database from JavaScript. There has to be some serverside script to execute a query and return the results. Thats what search.php is supposed to do. Jörn On Tue, Sep 23, 2008 at 8:51 PM, allan2008 [EMAIL PROTECTED] wrote: Hello. I'm trying to figure out the bassistance jQuery plugin: Autocomplete. From what I can gather if I want to get results remotely they must be held in an external php file (ie. search.phps). Is it possible for the plugin to get results directly from a mysql table? If so how can I get it to search through the table? Thanks.
[jQuery] Re: autosuggest help
Thanks for the help guys! I understand this much better now. I really appreciate your work Jorn, thanks for sharing with us!
[jQuery] Re: Autosuggest
That's odd, with my 150 items test list I found it didn't seem unreasonably slow in IE, though I didn't test in 6. In the end I had to rewrite the code without the support of jQuery because I couldn't figure out how to get fValidate to play nicely with it, and that version runs well in IE6. Here's the non-jQuery code if you're interested. try { // Standards compliant method of capturing mouse window.addEventListener ('load', addrSearchSetUp, false); } catch (e) { try { // Internet Explorer method of capturing mouse window.attachEvent ('onload', addrSearchSetUp); } catch (e) {throw (e);} } function getInnerText(elt) { var _innerText = elt.innerText; if (_innerText == undefined) { _innerText = elt.innerHTML.replace(/[^]+/g,); } return _innerText; } function addrSearchSetUp () { // Because fValidate seems to screw up jQuery DOM element insersion we'll have to do it the hard way var scroller= document.getElementById ('scroller'); var addrListItem= document.getElementById ('storedAddresses'); var searchBox = document.createElement ('input'); var label = document.createElement ('label'); var matchErr= document.createElement ('li'); var clear = document.createElement ('div'); var addrList= addrListItem.getElementsByTagName ('li'); var addrStrings = []; searchBox.id= 'addrSearch'; //searchBox.name= 'addrSearch'; searchBox.type = 'text'; label.id= 'addrLabel'; label.htmlFor = 'addrSearch'; label.appendChild (document.createTextNode ('Search your addresses')); clear.className = clr; clear.appendChild (document.createTextNode ('nbsp;')); matchErr.className = 'noMatch'; matchErr.style.display = 'none'; matchErr.appendChild (document.createTextNode ('Sorry, none of the addresses we have on record matched your search terms')); scroller.parentNode.insertBefore (clear, scroller.nextSibling); scroller.parentNode.insertBefore (searchBox, scroller.nextSibling); scroller.parentNode.insertBefore (label, scroller.nextSibling); //Cache the contents of the list items for (var thisItem = 0; thisItem addrList.length; thisItem++) { addrStrings.push (getInnerText (addrList [thisItem]).toLowerCase ()); } addrListItem.appendChild (matchErr); document.getElementById ('addressPicker').onsubmit = function () { return (false); }; searchBox.onkeyup = function () { var unmatched = false; var matchCount = addrStrings.length; // Convert input value to lower case, strip non-alphanumeric characters, strip multiple white space and split into an array of search terms var searches = this.value.toLowerCase ().replace (/[^a-z0-9 ]/g, ' ').replace (/\s+/g, ' ').split (' '); // Run through the list of addresses for (var thisItem = 0; thisItem addrStrings.length; thisItem++) { // Run through the list of search terms for (var thisSearch = 0; thisSearch searches.length; thisSearch+ +) { if (addrStrings [thisItem].match (searches [thisSearch]) === null) { // A search term couldn't be found in this address addrList [thisItem].style.display = 'none'; unmatched = true; matchCount--; break; } } if (unmatched) { unmatched = false; } else { addrList [thisItem].style.display = ''; } } matchErr.style.display = matchCount 0? 'none' : ''; }; } On Nov 20, 7:40 pm, Jean [EMAIL PROTECTED] wrote: I noted the speed for ie6 is very slow, but for FF is very good =p On Nov 20, 2007 7:37 AM, Gordon [EMAIL PROTECTED] wrote: $(document).ready (function () { var searchBox = $('input type=text name=addrSearch
[jQuery] Re: Autosuggest
$(document).ready (function () { var searchBox = $('input type=text name=addrSearch id=addrSearch /'); var addrList= $('#storedAddresses li'); var matchErr= $('li class=noMatchNo matches found/li'); var addrStrings = []; // Cache the contents of each list item addrList.each (function () { addrStrings.push ($(this).text ().toLowerCase ()); }); //console.log (addrStrings); $('#storedAddresses').append (matchErr); matchErr.hide (); $('#scroller').before (searchBox); searchBox.keyup (function () { // Convert input value to lower case, strip non-alphanumeric characters, strip multiple white space and split into an array of search terms var searches = this.value.toLowerCase ().replace (/[^a-z0-9 ]/g, ' ').replace (/\s+/g, ' ').split (' '); // Match elements against the supplied list of search words var elemsToShow = addrList.filter (function (index) { for (var thisSearch = 0; thisSearch searches.length; thisSearch+ +) { if (addrStrings [index].match (searches [thisSearch]) === null) { return (false); } } return (true); }); // Show matches, hide non-matches var elemsToHide = addrList.not (elemsToShow); elemsToHide.hide (); elemsToShow.show (); // If the search resulted in 0 matches then display an error message elemsToShow.length 0? matchErr.hide () : matchErr.show (); }); }); #storedAddresses is a HTML list of stored delivery addresses. #scroller is of no significance to the script and is simply a point in the DOM into which the search text box can be inserted. I was worried about speed, as the main loop does quite a lot of work, but it seems to remain responsive even with around 150 addresses in the address list. It also provides the behaviour I want, all the typed words have to be in the address for a match, but the order of the words in the search box is unimportant. On Nov 19, 9:54 pm, Gordon [EMAIL PROTECTED] wrote: Thanks for the suggestion, but it came too late. I've now already written something that seems to work pretty well. Will post source later for comments and in the hopes someone else will find it useful. On Nov 19, 6:49 pm, Sean O [EMAIL PROTECTED] wrote: Gordon, I think the quickSearch plugin:http://rikrikrik.com/jquery/quicksearch/ will help you. SEAN O __www.sean=o.com Gordon-35 wrote: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jq... demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the recipient followed by the address and post code for the autocomplete to work. If the user was to start with a postcode or street address, as most users would probably consider sensible, then the autocomplete would return no results.
[jQuery] Re: Autosuggest
I noted the speed for ie6 is very slow, but for FF is very good =p On Nov 20, 2007 7:37 AM, Gordon [EMAIL PROTECTED] wrote: $(document).ready (function () { var searchBox = $('input type=text name=addrSearch id=addrSearch /'); var addrList= $('#storedAddresses li'); var matchErr= $('li class=noMatchNo matches found/li'); var addrStrings = []; // Cache the contents of each list item addrList.each (function () { addrStrings.push ($(this).text ().toLowerCase ()); }); //console.log (addrStrings); $('#storedAddresses').append (matchErr); matchErr.hide (); $('#scroller').before (searchBox); searchBox.keyup (function () { // Convert input value to lower case, strip non-alphanumeric characters, strip multiple white space and split into an array of search terms var searches = this.value.toLowerCase ().replace (/[^a-z0-9 ]/g, ' ').replace (/\s+/g, ' ').split (' '); // Match elements against the supplied list of search words var elemsToShow = addrList.filter (function (index) { for (var thisSearch = 0; thisSearch searches.length; thisSearch+ +) { if (addrStrings [index].match (searches [thisSearch]) === null) { return (false); } } return (true); }); // Show matches, hide non-matches var elemsToHide = addrList.not (elemsToShow); elemsToHide.hide (); elemsToShow.show (); // If the search resulted in 0 matches then display an error message elemsToShow.length 0? matchErr.hide () : matchErr.show (); }); }); #storedAddresses is a HTML list of stored delivery addresses. #scroller is of no significance to the script and is simply a point in the DOM into which the search text box can be inserted. I was worried about speed, as the main loop does quite a lot of work, but it seems to remain responsive even with around 150 addresses in the address list. It also provides the behaviour I want, all the typed words have to be in the address for a match, but the order of the words in the search box is unimportant. On Nov 19, 9:54 pm, Gordon [EMAIL PROTECTED] wrote: Thanks for the suggestion, but it came too late. I've now already written something that seems to work pretty well. Will post source later for comments and in the hopes someone else will find it useful. On Nov 19, 6:49 pm, Sean O [EMAIL PROTECTED] wrote: Gordon, I think the quickSearch plugin:http://rikrikrik.com/jquery/quicksearch/ will help you. SEAN O __www.sean=o.com Gordon-35 wrote: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jq... demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the
[jQuery] Re: Autosuggest
http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/ demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the recipient followed by the address and post code for the autocomplete to work. If the user was to start with a postcode or street address, as most users would probably consider sensible, then the autocomplete would return no results. What I really need is something that works in a similar manner to the autocomplete plugins I've found so far, but that doesn't care about the order of the words typed into the search box. The only constraint should be that the strings being matched against contain all the words typed. For example, if an address is listed as Mister Foobar, 123 Fake street, Quuxville, AS1 23D, then the autocomplete plugin would suggest that address if the user typed in fake street as1, or fake foobar. Are there any autocumplete plugins that support doing this?
[jQuery] Re: Autosuggest
Instead of using one array of csv data, why not use nested arrays? On Nov 19, 6:48 am, Gordon [EMAIL PROTECTED] wrote: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jq... demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the recipient followed by the address and post code for the autocomplete to work. If the user was to start with a postcode or street address, as most users would probably consider sensible, then the autocomplete would return no results. What I really need is something that works in a similar manner to the autocomplete plugins I've found so far, but that doesn't care about the order of the words typed into the search box. The only constraint should be that the strings being matched against contain all the words typed. For example, if an address is listed as Mister Foobar, 123 Fake street, Quuxville, AS1 23D, then the autocomplete plugin would suggest that address if the user typed in fake street as1, or fake foobar. Are there any autocumplete plugins that support doing this?- Hide quoted text - - Show quoted text -
[jQuery] Re: Autosuggest
Gordon, I think the quickSearch plugin: http://rikrikrik.com/jquery/quicksearch/ will help you. SEAN O __ www.sean=o.com Gordon-35 wrote: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/ demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the recipient followed by the address and post code for the autocomplete to work. If the user was to start with a postcode or street address, as most users would probably consider sensible, then the autocomplete would return no results. What I really need is something that works in a similar manner to the autocomplete plugins I've found so far, but that doesn't care about the order of the words typed into the search box. The only constraint should be that the strings being matched against contain all the words typed. For example, if an address is listed as Mister Foobar, 123 Fake street, Quuxville, AS1 23D, then the autocomplete plugin would suggest that address if the user typed in fake street as1, or fake foobar. Are there any autocumplete plugins that support doing this? -- View this message in context: http://www.nabble.com/Autosuggest-tf4835224s27240.html#a13842444 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Autosuggest
Gordon schrieb: For example, if an address is listed as Mister Foobar, 123 Fake street, Quuxville, AS1 23D, then the autocomplete plugin would suggest that address if the user typed in fake street as1, or fake foobar. Are there any autocumplete plugins that support doing this? I'll try to add a demo that does just that, based on a UL. I'm planning one change anyway that should enable support for using the UL. Though the matching is another story. You want it to match any word in any order, with at least one word matched, right? Sounds like you'd need to provide your own matcher then. Jörn
[jQuery] Re: Autosuggest
Thanks for the suggestion, but it came too late. I've now already written something that seems to work pretty well. Will post source later for comments and in the hopes someone else will find it useful. On Nov 19, 6:49 pm, Sean O [EMAIL PROTECTED] wrote: Gordon, I think the quickSearch plugin:http://rikrikrik.com/jquery/quicksearch/ will help you. SEAN O __www.sean=o.com Gordon-35 wrote: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jq... demonstrates a plugin that's really close to what I want, it will pick up on elements where the word entered isn't the first word in the strings being searched. Unfortunately, it still requires all the words to be in the order they appear in the strings and doesn't seem to match when words are ommited. Try eastern, warbler and eastern warbler to see what I mean. If this plugin matched on eastern warbler or even on warbler eastern it would be pretty much just what I needed functionality wise. Additionally it doesn't need any ajax support as the UL with all the addresses in it is already on the page. I just need to process that list, and use it as the basis of the autocomplete. On Nov 19, 10:16 am, Gordon [EMAIL PROTECTED] wrote: I currently have a brief to develop a system to help people find addresses in a list loaded into a web page. At the moment they're displayed as a single long list (a ul), and the oser clicks the one he wants to use. The problem is that in some cases this list can run to hundreds of entries. The first plan was to simply have a button to click on the page that invokes the browser's ctrl-f behaviour, but there doesn't seem to be a sensible cross-browser way to do it. My second idea was to use jQuery and one of the autocomplete plugins, convert the list into the data the autocomplete plugin needs to operate on and suggest addresses as users type into the field. This seemed a better approach but then I hit a problem that the autocomplete plugins that I've found so far all seem to search on exact phrases, which is not going to be very useful. Addresses in the list are in the format recipient name, address, postcode so a user would have to start by entering the name of the recipient followed by the address and post code for the autocomplete to work. If the user was to start with a postcode or street address, as most users would probably consider sensible, then the autocomplete would return no results. What I really need is something that works in a similar manner to the autocomplete plugins I've found so far, but that doesn't care about the order of the words typed into the search box. The only constraint should be that the strings being matched against contain all the words typed. For example, if an address is listed as Mister Foobar, 123 Fake street, Quuxville, AS1 23D, then the autocomplete plugin would suggest that address if the user typed in fake street as1, or fake foobar. Are there any autocumplete plugins that support doing this? -- View this message in context:http://www.nabble.com/Autosuggest-tf4835224s27240.html#a13842444 Sent from the jQuery General Discussion mailing list archive at Nabble.com.