|
|
|
|
![]() ![]() |
Nov 11 2005, 02:03 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
Hey guys. I'm doing a web-based (running on an intranet) Inventory System for my final requirement in school. I'm looking for a code to autocomplete a form like if I type in a few letters in a textfield, the rest of the word gets displayed already or if I type in a few letters of an item in a drop-down menu (Select), the focus goes to that item.
Has anyone done this before or does anyone have the code for this? Thanks very much |
|
|
|
Nov 11 2005, 02:19 AM
Post
#2
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 2,224 Joined: 5-November 05 From: That one place over there... Member No.: 13,830 |
It does it by itself. I did a bit of research, and with a bit of editting I cam up with this code. It will do it for you. Just type in the first letter of the name and it will automatically highlight it. This particular dropdownbox is for a navigation.
QUOTE <FORM>
<SELECT NAME="blah"> <OPTION VALUE="">Choose a Destination... <OPTION VALUE="/url/" >Guide to HTML <OPTION VALUE="/url/" >Idocs Home Page <OPTION VALUE="http://Trap17.com" >Trap 17 </SELECT> <INPUT TYPE=SUBMIT VALUE="Go"> </FORM> |
|
|
|
Nov 11 2005, 02:27 AM
Post
#3
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
Dropdowns will behave just like folders in Windows Explorer - type in some letters and it'll take you to it. Text inputs would be an entirely different story. You might be able to do it using javascript but I can see it being difficult to code especially when you have to consider that each browser is already going to have its own store of words previously typed into form elements which might clash with what the javascript is trying to output.
|
|
|
|
Nov 11 2005, 08:52 AM
Post
#4
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 1-November 05 From: SATA II Member No.: 13,683 |
hi, i'am not family with this tech. but i do a search of ms web site and found this url that may help you.
AutoComlete HTMl forms - hope this help. |
|
|
|
Nov 16 2005, 08:57 AM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
Thanks guys for your suggestions.
Tyssen...The textfield is the most tricky because I would have to make use of data from a database so it's very likely that I'd be having difficulty if I just use javascript and I already plan on coding with PHP. I agree with what you said, Windows IE does have its own autocomplete functions in forms but I don't want the textfield to include words that are not present in my database. I hope what I'm saying is not all gibberish to you. |
|
|
|
Nov 17 2005, 12:02 AM
Post
#6
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
I'm not aware of any way that you can access information from your database without the form being submitted to the server, so in other words, you're not going to get any 'real time' interaction as the person is typing. Remember, that only javascript can be used for client-side interaction which is what you're talking about here. Everything else has to be submitted to the server first.
You might be able to access your db and get it to print out an array of suitable words into a javascript function which is then tied to your text inputs, but it seems like it'd be a lot of work for a fairly small return. The other possibility is that you might be able to accomplish what you want with AJAX but I don't know enough about it. |
|
|
|
Nov 17 2005, 05:51 AM
Post
#7
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 67 Joined: 16-November 05 Member No.: 14,373 |
the only way to do this would be through javascript. an example is google suggest (http://www.google.com/webhp?complete=1) . they use a very complicated algorithim to decide what the suggest text will be though. is that what you were talking about?
|
|
|
|
Nov 21 2005, 10:51 AM
Post
#8
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
I think I found a program. My friend told me about MX Widgets, an add-on (sort of) for Dreamweaver MX. I googled it and I'm planning to download the trial version soon (now actually) since I'm already using Dreamweaver.
From the Widgets website CODE MX Widgets offers a powerful alternative to the regular HTML controls for Dreamweaver developers. Unlike standard HTML forms, our product relies on the power of the server side language and JavaScript to enforce an accurate and user friendly form completion: combo-boxes, date pickers, masked inputs, calendar controls and others. I think this is what I need: CODE It allows the users type text in a dynamic drop-down menu and locates records based on the user's entered text. The field has an auto-complete feature, which fills in the first found matching entry. In order to select a record, the user can also use the down arrow key, or expand the menu
|
|
|
|
![]() ![]() |
Similar Topics