|
My 5 for a great Article.
|
|
|
|
|
Great piece of software, thanks
|
|
|
|
|
Can someone please look at this and tell ,me why the AutoSuggest asp-vb code does not work!
Well, I figured it out, it was an ID Ten T (or Id10t) problem. Note the "kingcup' double and single quote mix!!!
Change to double code and problem is fixed.
By the way either 'kingcup' or "kingcup" will work
NOTE: In the original code that can be copied it has "kingcup' in it !!
Dmitri : If you have a chance, please correct the entry
<HTML><HEAD>
<link rel="stylesheet" type="text/css" href="autosuggest.css"></link>
<script type="text/javascript" src="autosuggest.js"></script>
<script>
var customarray = ["apple", "alligator", "banana", "elephant",
"pear", "kingbird", "kingbolt", "kingcraft",
"kingcup", "kingdom", "kingfisher"];
</script>
</HEAD>
<!-- Instruction : http:
<body>
<table border="4" width="100%" align = "center" bgcolor="#c0c0c0" id="table1" cellpadding = 1 cellspacing = 1 >
<tr><td colspan="1" ><p align="center">Test Auto AutoSuggest (apple, Kingbird, etc)</p></td> </tr>
<tr><td colspan="1" width="50%" >Current test list : ??<%=customarray%>??</td></tr>
<tr><td colspan="1" width="50%" >
<input type="text" id="tb" value="" style="font-family:verdana;width:300px;font-size:12px" />
<script > var obj = new autosuggest("tb",customarray ); </script>
</table>
</body>
</html>
Thanks, Henry
Detroit, USA
|
|
|
|
|
Can someone help me with my problem?
I want to be able to pick string value from textbox and return id value that will be send with form.
for example:
I have
<input type="text" id="id_" value="" />
<script type="text/javascript">
var arr = new Array();
arr.push(new Array("xx", 1);
arr.push(new Array("yy", 2);
arr.push(new Array("zz", 3);
var obj = new autosuggest("id_", arr);
</script>
and I want to see the "xx", "yy", "zz" when I use autosuggest textbox and after I pick for example "xx" I want the id_ from field to have 1 value that can be send with
|
|
|
|
|
Hi Dmitry..
i'm just a newbie in the jsp..
can you explain, how to send .xml data into the autosuggest in jsp..
Thanx in advance.
|
|
|
|
|
I've got auto-suggest working perfectly. It's great. I can use multiple text fields without any problems, except when I put the field within a form.
This is test code that works for the built-in array and for server side auto-suggest. Works perfectly in both cases.
When I had this working, I'd thought that I would have no problems getting this into real code.
<html>
<head>
<link rel="stylesheet" type="text/css" href="autosuggest.css"></link>
<script type='text/javascript' src='autosuggest.js'></script>
<script>
var customarray = ["apple", "alligator", "banana", "elephant",
"pear", "kingbird", "kingbolt", "kingcraft",
"kingcup", "kingdom", "kingfisher" ];
</script>
</head>
<body>
<input type="text"
id="tb" value=""
style="font-family:verdana;width:300px;font-size:12px" />
<script>
var obj = new autosuggest("tb", customarray);
</script>
<input type="text" id="tb2" value="" style="font-family:verdana;width:300px;font-size:16px" />
<script>
var obj = new autosuggest("tb2", "", "http://127.0.0.1/autosuggest.wsgi/?field=npi&s=");
</script>
</body>
</html>
For whatever reason, auto-suggest is not reading in the strings from the fields when it's in a form.
<form id="subForm" name="subForm" method="post" onSubmit="return verifyForm(this);" action="http://127.0.0.1/retrieve.wsgi">
<div class="box">
<h2>Store information</h2>
<p>
<label class="label">NPI#</label><input type="text" name="npi" id="npi" />
<script type="text/javascript">
var obj = new autosuggest("npi", "", "http://127.0.0.1/autosuggest.wsgi/?field=npi&s=");
</script>
</p>
I've tried changed the ids passed to autocomplete but that didn't work. I followed the code using Firebug and I can see that the code isn't failing but it's not finding the text from the field.
On about line 35, I can see that the correct field id is being assigned.
function autosuggest(id, array, url, onSelect)
{
var field = document.getElementById(id);
The form actually contains about 15 fields. Rather than having the users guess what might data might actually be present in the database for that field, I'd like to present the most likely data first.
I'd greatly appreciate any assistance or guidance you can provide.
Thank you.
modified on Saturday, December 4, 2010 1:42 PM
|
|
|
|
|
Good morning Joanne,
I've just tested the script with the following page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Autosuggest control test page</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<!-- Page styles: -->
<style type="text/css">
input
{
font-size: 12px;
font-family: verdana;
}
table
{
width: 100%;
text-align: center;
}
td
{
vertical-align: top;
}
</style>
<!-- Autosuggest control's includes: -->
<link rel="stylesheet" type="text/css" href="styles/autosuggest.css"></link>
<script type="text/javascript" src="scripts/autosuggest.js"></script>
</head>
<body>
<form id="subForm" name="subForm" method="post" önSubmit="return verifyForm(this);" action="http://127.0.0.1/retrieve.wsgi">
<table>
<tr>
<td>
<!-- Installation with the webservice as a back-end: -->
<input type="text" id="target" size="40" value="" />
<script type="text/javascript"> new autosuggest("target", null, "http://localhost/Autosuggest/autosuggest.php?q="); </script>
</td>
</tr>
</table>
</form>
</body>
</html>
(I have Apache server on the "localhost")
- and everything worked great. Can you please check 2 things:
1. Does the page send the data? You can check if the request is made with TamperData extension for Firefox.
2. Please try to add the XHTML declaration. Not sure about this, though - for me everything worked without it.
If you wish - I can send you the whole testbed with PHP/MySQL code.
Even better - maybe any public page for me to test?
Best regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
How don't know how I stumbled upon this autocomplete="off" directive but I tried it and it worked! Now each field successfully works.
<form id="subForm" name="subForm" method="post" onSubmit="return verifyForm(this);" action="http://127.0.0.1/retrieve.wsgi" autocomplete="off">
Thank you.
|
|
|
|
|
Well, it seems that browser's history somehow interfered with the auto-completion.
I didn't notice it, because my privacy options are maxed out, so field history is not recorded.
Thank you for letting me know, anyway
- Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
First, very nice functionality!
It would be good to be able to give the id of the destination of selected value as an argument.
such that when you select a value, it is transferred to a "read-only" text-field, thus ensuring that the user doesn't write anything wrong.
|
|
|
|
|
Hi Pascal,
pascal_a wrote: It would be good to be able to give the id of the destination of selected value as an argument.
current code already has the callback function - it's very task is to allow you to do whatever you want to do. You can just get the field from inside the callback and assign it's value to the selected one, voila
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Yes. You are right
Thanks for the quick answer.
|
|
|
|
|
I have a couple of questions regarding the ajax call
1, can the url have parameters? I would like to call a perl script and pass 2 parameters to it like year and model.
2, why do you need the question mark at the end of the url string?
here is what I would like to use
var line = 'FieldId';
var url = "vin.pl?Year="+year+"&Model="+model;
asbbox[line] = new autosuggest(line, '', url);
The file that is sent to the browser from the perlscript is <pre><listdata>6_abc123_1989_HONDA_CIVIC_JHMED3543KS803978|680__1989_HONDA_CIVIC_JHMED3643KS801632|1002__1989_HONDA_CIVIC_JHMED7362KS801537|1140__1989_HONDA_CIVIC_JHMED3641KS800205|1171__1989_HONDA_CIVIC_JHMED6303KS800659|1197__1989_HONDA_CIVIC_JHMED9361KS800116|1404__1989_HONDA_CIVIC_2HGED6306KH002649|2194__1989_HONDA_CIVIC_2HGED6304KH002830|2443__1989_HONDA_CIVIC_JHMED9360KS800785|2636__1989_HONDA_CIVIC_JHMEE2753KS800110|3193__1989_HONDA_CIVIC_JHMED8357KS800137|3299__1989_HONDA_CIVIC_1HGED3643KA800053|3750__1989_HONDA_CIVIC_JHMED835XKS800276|3808__1989_HONDA_CIVIC_JHMED3508KS801656|3884__1989_HONDA_CIVIC_JHMED8355KS800167|4195__1989_HONDA_CIVIC_JHMED936XKS800177|4255__1989_HONDA_CIVIC_1HGED3645KA802130|4644__1989_HONDA_CIVIC_JHMED9366KS801858|4811__1989_HONDA_CIVIC_JHMED9363KS801705|5065__1989_HONDA_CIVIC_1HGED3509KA804056|5480__1989_HONDA_CIVIC_JHMED936XKS801149|5705__1989_HONDA_CIVIC_JHMED6341KS801246|7834__1989_HONDA_CIVIC_2HGED6336KH003021|8664__1989_HONDA_CIVIC_1HGED3604KA802486|8728__1989_HONDA_CIVIC_JHMED3608KS800120|8746__1989_HONDA_CIVIC_2HGED630XKH002864|10732__1989_HONDA_CIVIC_JHMED3500KS801487|10736__1989_HONDA_CIVIC_2HGED7360KH012023|10738__1989_HONDA_CIVIC_1HGED3546KA801814|10739__1989_HONDA_CIVIC_1HGED3540KA803929|10741__1989_HONDA_CIVIC_JHMED6301KS802765|10946__1989_HONDA_CIVIC_JHMED3541KS803249|11046__1989_HONDA_CIVIC_JHMED630XKS803302|11189__1989_HONDA_CIVIC_1HGED3641KA804344|15763__1989_HONDA_CIVIC_JHMED9363KS800098</listdata></pre>
Thanks for your help with this. The autosuggest version I am using is 2.3.
|
|
|
|
|
I know this is an old post, but I got parameters to work correctly by putting a "&" the end of my ajax url (ie, after my last argument). The code appends an additional argument to the url. That is why you have to have the '?' at a minimum at the end.
|
|
|
|
|
Nice script. Unfortunately there is at least one limitation. The auto suggest fails if the leading character in one of the array items is an asterisk.
i.e This works:
var custom_array_2 = [['audi**,test', 1], ['bentley', 2]];
This does not:
var custom_array_3 = [['**audi,test', 1], ['bentley', 2]];
|
|
|
|
|
Hello
and thanks for the great work
I have got the following problem (WinXP & FF3.5+IE8+?):
We want to use Autosuggest via an input field in a fixed bottom (search)footer - but most parts of the suggestion list items appear below the footer - see http://www.network-taps.eu/sugglist-bug.jpg
Any idea how I could solve this problem ?
Thanks in advance.
|
|
|
|
|
Hi,
I am using the code below to dynamically create array with data flowing in from an MDB file named test_db.mdb,
But anyhow this dosent seem to work. Please help
Thanks
Salan
------------------------------------------------code ---------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Autosuggest test page</title>
<!-- Page styles: -->
<style type="text/css">
input
{
font-size: 12px;
font-family: verdana;
width: 300px;
}
table
{
width: 100%;
text-align: center;
}
</style>
<!-- Autosuggest includes: -->
<link rel="stylesheet" type="text/css" href="autosuggest.css"></link>
<script type="text/javascript" src="autosuggest.js"></script>
<!-- Autosuggest data: -->
<script type="text/javascript">
var custom_array = [
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("test_db.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
salan1 = "SELECT count(*) as Total FROM area"
Set salan2 = MyConn.Execute(salan1)
SQL_query = "SELECT * FROM area"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
i=i+1
res = i
if res < salan2("Total") then %>
'<%=RS("word")%>', <% end if %><% if res = salan2("Total") then %> '<%=RS("word")%>' <% end if %>
<%
RS.MoveNext
WEND
%>
];
</script>
</head>
<body>
<input type="text" id="tb" value="" />
<script type="text/javascript"> new autosuggest("tb", custom_array); </script>
|
|
|
|
|
Hi all,
Is it possible to turn off the suggestions after and particular character example "=" and then continue once the delimter is typed.
please help me out...
|
|
|
|
|
I like this article and simply answer my long wondering. Thanks!
|
|
|
|
|
Nice work...
|
|
|
|
|
the lastest version works like magic both in IE6 and firefox. I use client side array with more than 100,000 elements!! works resonably fast...
Thanks to the author!!!!
|
|
|
|
|
I've got 8 choices only, so I would like the suggestions to show up at the onFocus event. How would I do this?
|
|
|
|
|
That is I don't want to have to type a character for the suggestions to show. . .
|
|
|
|
|
|
hello.
I'm not good at English,but I'm trying to describe it clearly,please keep pacience.
the suggestion never appear when I type something such as "abc" in the field,but when I delete them all with "backspace" key quickly it appears.it will not appear if I delete them slowly.I test it with IE and firefox,they are same result.
another question:it seems the start_check never works when I use ajax fetch data.it gets data when I input the first character despite I set it like this:
this.start_check = 2;
it will overload the server.
here is the demo:http://121.63.222.140/tickets/index_ajax.html[^]
thank any ideas.modified on Sunday, March 7, 2010 6:21 AM
|
|
|
|
|