473,372 Members | 1,050 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,372 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 1975

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.