473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Auto-Suggested Textbox like google auto suggest

I need to create a Auto suggests Textboox like in
http://www.google.com/webhp?complete=1&hl=en
I have completed this using AJAX.NET for Framework 1.1 . I have some design
issues after the data is populated.

For me the problem is I am getting more space after the item is selected.
And the items are displayed in a combo when i am going for another search /
selection without refreshing the page.
I am expecting a same output as google's auto suggested textbox.

see my work at http://www.reccustodian.com/Dropdown/Neworder.aspx

Please let me know if you get any on this.

The below is the javascript which helps to display the text box and the combo

//matches select
var matcheList = document.getElementById("matches");

//called by the onKeyUp javascript event on the input
function FindMatches(searchCriteria)
{
if (searchCriteria)
{
//SearchComplection is defined by Ajax.Net because that's the name of
the type we registered
NewOrder.FindMatches(searchCriteria, FindMatches_CallBack);
}
else
{
//clear the states dropdown
matcheList.style.visibility = "hidden";
}
}
//callback we told Ajax.Net to pass the response tos
function FindMatches_CallBack(response)
{
//if the server side code threw an exception
if (response.error != null)
{
alert(response.error); //we should probably do better than this
return;
}

//if we didn't get what we expect, or didn't get any matches
if (!response.value || response.value.length == 0)
{
matcheList.style.visibility = "hidden";
return;
}

matcheList.style.visibility = "visible";
matcheList.options.length = 0; //reset the states dropdown
matcheList.size = response.value.length; //dynamically set the size of
the select box
for (var i = 0; i < response.value.length; ++i)
{
matcheList.options[matcheList.options.length] = new
Option(response.value[i]);
}
}

//called when a match item is selected from the list
function MatchSelected(matches)
{
var state = document.getElementById("state");
var divDisp = document.getElementById("divList");
state.value = matches.options[matches.selectedIndex].text;
matcheList.style.visibility = "hidden";
//document.frmOrder.txtPClaimNo.focus();

matcheList.style.height="40px"

divDisp.style.visibility = "hidden";

selected = matcheList.options.selectedIndex;
value = state.value

if (selected !=0 || selected ==0)
{
count=3
for (var i = 0, oldpos = -1; i<count-1; i++)
{
pos = value.indexOf(',',oldpos+1);
data = value.substring(oldpos+1,pos);
frmOrder.elements['txtC' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
frmOrder.elements['txtC' + i].value =
value.substring(oldpos+1,value.length)
}
}

Thanks
Kumar

Apr 20 '06 #1
0 1976

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: marmot101 | last post by:
Hi, All, I create an array of TextBox and add them to a windows form by program. It works fine. However, whenever I open the form, the text in first TextBox is always SELECTED, how can I stop...
4
by: Rick Csucsai | last post by:
After a year and a half of not touching ASP.NET, I have finally talked my company into letting me build a useable app in .NET instead of classic. Now I have to play catch up. i would really...
0
by: Waran | last post by:
Hi, Please look the fields (Insurance, Defense Attorney, Applicant/Plaintiff Attorney) under party list in http://www.reccustodian.com/defensepro/order/neworder.aspx The above said fields are...
1
by: jhreddy | last post by:
Hi everyone, In textbox i used default value as current date. If user wants to type date then he/she does not need to type ‘/’ between, it should come automatically. so how can do that..
1
by: arti | last post by:
My Auto Suggest Text Box- (in ASP.Net using AJAX) works fine on my Local machine but not when the application runs on server. WHat happened?
1
by: alingeorge | last post by:
I am using Ajax Control kit as extension in Asp.Net and i need to display the auto suggest technique in a text box... Values must be taken from a Sql Server 2005 data base... I need the full coding...
2
dlite922
by: dlite922 | last post by:
I was looking for a solution similar to google auto suggest where the user clicks or begins typing and a drop down appears, istock.com search field has it too. don't worry about the Ajax part, I...
2
by: sukatoa | last post by:
Good day, Im new to JavaScript and would like also to learn Ajax by having experiments and to apply directly to an application(Hope this could also be effective) Now, i will attempt to conduct...
1
by: deepaks85 | last post by:
Dear Friends, I work in php with mysql database and want to create a search box just like google where user can type in and gets auto suggestion, navigate with keyboard arrow keys and search it...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.