Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type in first letters and the rest of the name will appear

Status
Not open for further replies.

upr

MIS
Oct 13, 1999
3
US
I am trying to use HTML to type in the first letters of a name, for example for Craig Smith, type in Cra and it will show a drop down list of all of the names beginning with those letters. I am assuming that this is done with an SQL query, but I looked at the source code for a site that did this and did not see anything different than an ordinary text box. <br>

 
Of course you will only see HTML. You generally cannot see server-side SQL code in a browser unless the site developer wants you to. The HTML form takes your search terms and submits them to the server, where the SQL query runs, and then the results are returned &quot;encased&quot; in HTML.<br>
<br>
By default, all drop-down menus in HTML will jump to the first letter entered, but to go beyond that, and have a true 'autocomplete' feature you would need to use Javascript, which would query ahead and return an index of possible entries in an array which can then supply the completed words as users type entries. This would be an excellent feature to provide for a browser-based application. Please give me the URL to the site you mention above, and I'll see if they use any Javascript. Also, Try the Javascript forum.<br>
<br>
Good luck
 
Let me see if I understand you... you start out with a textbox, a button, and a drop-down menu, all seperate items. When you press the button, a JavaScript function is called which parses the text in the textbox, checks the text against items in an array or database, and then returns all names beginning with that text, to be shown in the drop-down menu, dynamically, without the page reloading. Is that what you want? Or do you want to cut out the button, and have the script recalculate the names everytime the textbox's contents have changed?<br>
<br>
For a second there, it almost sounded like the IE5 option where, depending on what you type in a textbox, a pseudo-dropdown menu shows up under the textbox with all the previous entries starting with the same letters... it's not that, is it? <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence."
 
You would need to set up a cookie to be completely sure that this could work and that would be the only way since Netscape has yet to include an autocomplete feature in their browser (actually, I hope they don't because I find it annoying in IE5). Once you've created the cookie, you would then read it in JavaScript and return that to the browser as a floating frame or layer like what what is used at <A HREF=" TARGET="_new"> This is really the only way you could do a true autocomplete in either Netscape or IE (although, with IE, I would just leave it alone). <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top