[Proto-Scripty] Re: How to display searched charaacters in autocomplete in Bold
There is no in-built mechanism within Scriptaculous itself which will do hightlight of letters automatically??? Thanks! On Wed, Sep 10, 2008 at 2:00 AM, ColinFine <[EMAIL PROTECTED]> wrote: > > > > On Sep 9, 10:12 pm, Jack <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm using 1.8.4 latest scriptaculous library for autocomplete > > functionality. Everything works Perfect! > > > > I would like to know if scriptaculous supports highligting the > > returned results. When I type say "a" in the textbox, then the > > scrollable options will appear with results which contains "a". What I > > need is that the returned results should display the searched > > chanracter (in this case "a") in bold throughout all the occurences > > within resultset. > > > > I'll appreciate if any one can help me acheiving this > > functionality using scriptaculous. > > > I would do this in your server-side code. Something like: (untested > PHP!) > > function matchPart($part) > { > $matches = getMatches($part); > $result = "n"; > foreach ($match in $matches) { >$result .= "".preg_replace("/$part/g", "$part", > $match)."."\n"; > } > // Return your $result however you're doing it ... > } > > Ajax.Autocompleter IIRC concatenates all the text nodes from the > selected , so the tags would just be omitted in the submitted > value. > > Colin > > > > > > Thanks in Advance! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: How to display searched charaacters in autocomplete in Bold
On Sep 9, 10:12 pm, Jack <[EMAIL PROTECTED]> wrote: > Hi, > I'm using 1.8.4 latest scriptaculous library for autocomplete > functionality. Everything works Perfect! > > I would like to know if scriptaculous supports highligting the > returned results. When I type say "a" in the textbox, then the > scrollable options will appear with results which contains "a". What I > need is that the returned results should display the searched > chanracter (in this case "a") in bold throughout all the occurences > within resultset. > > I'll appreciate if any one can help me acheiving this > functionality using scriptaculous. > I would do this in your server-side code. Something like: (untested PHP!) function matchPart($part) { $matches = getMatches($part); $result = "n"; foreach ($match in $matches) { $result .= "".preg_replace("/$part/g", "$part", $match)."."\n"; } // Return your $result however you're doing it ... } Ajax.Autocompleter IIRC concatenates all the text nodes from the selected , so the tags would just be omitted in the submitted value. Colin > Thanks in Advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: How to display searched charaacters in autocomplete in Bold
Why not to do it on your own? E.g. smth like this? var st = result.toLowerCase().indexOf(keyword.toLowerCase()); if (st != -1) { var output = result.substring(0, st) + '' + result.substring(st, st + keyword.length) + '' + result.substring(st + keyword.length); } else { var output = result; } On Sep 10, 3:12 am, Jack <[EMAIL PROTECTED]> wrote: > Hi, > I'm using 1.8.4 latest scriptaculous library for autocomplete > functionality. Everything works Perfect! > > I would like to know if scriptaculous supports highligting the > returned results. When I type say "a" in the textbox, then the > scrollable options will appear with results which contains "a". What I > need is that the returned results should display the searched > chanracter (in this case "a") in bold throughout all the occurences > within resultset. > > I'll appreciate if any one can help me acheiving this > functionality using scriptaculous. > > Thanks in Advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---