|
|
Comments and Discussions
|
|
 |
|
|

|
PHP PEAR class can make life much simpler.
Demostrated below is a sample of how PHP PEAR library can be used to implement AutoComplete functionality of a text box.
require 'HTML/QuickForm.php';
$teams = array('Amit','Satyan','Saswat','Chinmoya','Sonali','Kiran','Ansuman','Hemendra');
$form = new HTML_QuickForm();
$element =& $form -> addElement('autocomplete','teams','Favorite Engg Team:');
$element -> setOptions($teams);
$form->display();
?>
Now, save the file in a virtual directory and access it from browser. The text box would be populated with the values hard-coded above.
http://www.mindfiresolutions.com/AutoComplete-text-box-using-PHP-PEAR-Class-610.phpCheers,
Eliza
|
|
|
|

|
It doesn't work with mozilla 3.0.10
|
|
|
|

|
It does not working in MAC - safari
|
|
|
|

|
I tried to use the above code .But it's not working . Can u help me ???
Pratheesh
|
|
|
|

|
hello,
thanks for helpful article,
Can I have a look of all elements in my array list on some event of autotextbox. Or can i have list on entering a character like "*", that will
give complete list.
Will be helpful if any one can suggest a way!
|
|
|
|

|
Hi!
I would like to know how I can use this feature with 2 Edit Control.
For example :
var list_county = new Array('A','B','C');
var list_city = new Array('A','B','C');
<input type="text" name="Count" id="county_id" value="" size="32">
<script>
var obj1 = actb(document.getElementById('county_id'),list_county);
</script>
<input type="text" name="City" id="city_id" value="" size="32">
<script>
var obj2 = actb(document.getElementById('city_id'),list_city);
</script>
it doesn't work
Thank you very much for your answer, it's very important for me!
If you have an exemple with this feature with this component it'll be very good!
Steeve Le Provost
|
|
|
|

|
<script>
var list_county = new Array('A','B','C');
var list_city = new Array('A','B','C');
<script>
<input type="text" name="Count" id="county_id" value="" size="32">
<script>
var obj1 = actb(document.getElementById('county_id'),list_county);
</script>
<input type="text" name="City" id="city_id" value="" size="32">
<script>
var obj2 = actb(document.getElementById('city_id'),list_city);
</script>
|
|
|
|

|
Hi guys,
I'd like to show you my version of autocomplete, and you are welccome to change it.
I tested it with IE and works like as expected.
supports UP, DOWN, HOME, PAGE UP, PAGE DOWN keys. it should be very easy to add functionality for other browser. haven't tested for bugs though
http://www.frozendev.com/temp/auto/frameset.html
Cheers
Dave
|
|
|
|

|
Great one...
But why doesnt it work in Mozilla?
Anyone found a solution yet?
Thanks.
|
|
|
|
|
|

|
this does not work with mozilla because it does not have createTextRange();
|
|
|
|

|
Just
var stmp = n.value.split(" ");
var x = stmp.length-1;
var tmp = stmp[x];
instead of
tmp = n.value;
|
|
|
|

|
Anybody else that receives an error when entering text in the second textbox?
The "fruit" -box work fine, but the "name" -box generates the following error:
'tmp2' is null or not an object
|
|
|
|

|
Hi Emelian,
The error results due to the array 'name'. Apparently, this is a predefined object in Internet Explorer and thus could not be used. It will work fine if you change the code from
name = new Array('tom','dick','harry','john','petter','foo','bar');
to
names = new Array('tom','dick','harry','john','petter','foo','bar');
and
<input name='Name' type='text' class='textbox' title="Opening" backspace='false' önkeyup="autocomplete(this,name)">
to
<input name='Name' type='text' class='textbox' title="Opening" backspace='false' önkeyup="autocomplete(this,names)">
thank you for pointing out this error
regards,
zichun
|
|
|
|

|
That worked better!
Do you have an idea on how to make this code work with unicode characters (east-asian etc)?
Best regards
Emelian
|
|
|
|

|
sorry I'm not really familiar with unicode encodings and how javascript intepretes the character Perhaps someone who is knowledgable in unicode-javascript integration can give his/her advice?
|
|
|
|

|
Nice script. Change the existing line:
if (tmp2.charAt(i) == tmp.charAt(i)){
to
if (tmp2.charAt(i).toUpperCase() == tmp.charAt(i).toUpperCase()){
to help with case insensitive matches.
|
|
|
|

|
thank you very much
|
|
|
|

|
This is cool, but how about wrapping it into a server control to allow it to be used in a more ASP.NET style of coding....
|
|
|
|
|

|
if i want to enter "pea" , not "pear" pressing DEL key, contents
are updated to "pear". maybe need some check on what key is pressed...
----------------------------
never stop coding.
|
|
|
|

|
You can edit function with the following code from
if (event.keyCode == 8 && n.backspace){
n.value = n.value.substr(0,n.value.length-1);
n.backspace = false;
}
to:
if (event.keyCode == 8 && n.backspace){
n.value = n.value.substr(0,n.value.length-1);
n.backspace = false;
}else if (event.keyCode == 46){
var r = document.selection.createRange();
r.text = "";
return 0;
}
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Shows how to implement a Javascript based autocomplete edit control
| Type | Article |
| Licence | |
| First Posted | 21 Aug 2003 |
| Views | 138,661 |
| Bookmarked | 37 times |
|
|