Agarwal, Shyam
2006-Feb-13 09:42 UTC
would like to have the input text highlighted in the autocomplete div
Hello everyone, I would like to have the input text highlighted in the autocomplete div (similar to google suggest) Any ideas how I can get this working with the autocomplete class ? Thanks, Shyam
Bob Silva
2006-Feb-13 09:58 UTC
RE: would like to have the input text highlighted inthe autocomplete div
Cant. If you write a patch you can. I imagine it will work its way into scriptaculous eventually. Bob Silva http://www.railtie.net/> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs- > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Agarwal, Shyam > Sent: Monday, February 13, 2006 1:42 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] would like to have the input text highlighted > inthe autocomplete div > > Hello everyone, > > I would like to have the input text highlighted in the autocomplete div > (similar to google suggest) > > Any ideas how I can get this working with the autocomplete class ? > > Thanks, > Shyam > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Chris Lear
2006-Feb-13 11:33 UTC
Re: would like to have the input text highlighted in the autocomplete div
* Bob Silva wrote (13/02/06 09:58):> Cant. If you write a patch you can. I imagine it will work its way into > scriptaculous eventually.Here''s some code from DWR: / * Copyright 2005 Joe Walker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 */ /** * Select a specific range in a text box. * This is useful for ''google suggest'' type functionallity. * @param ele The id of the text input element or the HTML element itself * @param start The beginning index * @param end The end index */ DWRUtil.selectRange = function(ele, start, end) { var orig = ele; ele = $(ele); if (ele == null) { alert("selectRange() can''t find an element with id: " + orig + "."); return; } if (ele.setSelectionRange) { ele.setSelectionRange(start, end); } else if (ele.createTextRange) { var range = ele.createTextRange(); range.moveStart("character", start); range.moveEnd("character", end - ele.value.length); range.select(); } ele.focus(); }; It might be useful for that patch. Chris