home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Select Box - Dynamic Cursor?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1772
Discussions: 200,950, Posts: 2,379,452, Members: 246,312
Old June 25th, 2002, 06:45 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: So. California, USA
Posts: 2
Question
Select Box - Dynamic Cursor?

I've searched all over the web and all through my webmaster reference books, and have yet to find an answer to my problem: how to create a database-populated select box control in an asp page in which the cursor automatically jumps to the first appropriate item in the list as the user types an entry into the empty select box.

By default, the select box cursor jumps to the first item in the list that begins with the last letter typed by the user. Consider this drop-down list for a given select control:

Amsterdam
Buenos Aires
Ellington
LeComte
Leeds
London
New York
Sydney

Suppose the list is actually very long, and the user is looking for 'Leeds'. In a VB or Access drop-down, if the user types the letters "Lee" in a select box/drop-down control, the cursor will jump to the first item in the list that begins with "Lee" and bring him to his desired entry of "Leeds". In an asp page, the cursor only seems able to search the list based on the last letter typed by the user. In this example, the cursor would jump to "LeComte" when the user types "L", then to "Ellington" when the user adds an "e" to his entry, and again to "Ellington" when the user adds another "e" to his entry. How can I code a select box control in an asp page that will behave like a select box control in VB or Access? Note that my select boxes are typically populated from a database, so a Javascript control won't work.
april is offline   Reply With Quote
Old June 25th, 2002, 07:36 PM     #2 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
Sorry, but what you want to do is pretty much impossible using current technology. See, the HTML standards to date have two main types of input control - the text box, and the dropdown list (also the multiline text box, the password box, but these are just variants). What you want to use, what you've been using in VB, is a combo drop-down box, i.e. a combination of a text box and a dropdown list. These are not supported by HTML, so I'm afraid I can't really see a way forward except as you said using Javascript, which you can't do.
strangerstill is offline   Reply With Quote
Old June 26th, 2002, 12:12 AM     #3 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
strangerstill is correct in the limitations of the HTML objects, at best drop-down with multi-select capabilities, not custom searching.

I've made what you describe as a PB class and in java (AWT? Swing?, I forget). Both would find match to typed text, or iffin no match could/could not make new entry, depending upon what you want. I know this is really not helpful, but the PB class could reference other instances of same class, never had need in java. What this means is three drop-downs, customer, order, product. Choose customer, order DD filtered for that cust, choose order, product DD filtered for cust/order combo. Users loved it and worked great.

Now, I have seen some javascript objects behave somewhat like you describe, tho browser compatibility may be issue. No good example to offer...

So, why:

Quote:
Note that my select boxes are typically populated from a database, so a Javascript control won't work.

I doubt ASP has achieved a level of sophistication much greater than when I used (maybe me missing something???). To populate DD, used:

ASP ADO to execute DB query to display. ASP code to generate HTML:

Code:
<select name=selectname size=1>
<option value=''>val</option>....
</select>
Whether generate HTML or browser based javascript, what's the big deal?
qball is offline   Reply With Quote
Old June 26th, 2002, 12:48 AM     #4 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
ya, I think you would have to either make a custom activex control in vb (or your desired language of choice) and then users would have to accept your activex control on their first visit to the webpage. Otherwise, as qball mentioned, you could probably do it with a combination of a textbox, drop-down box and javascript... possibly lots of javascript if you want it to play nicely in all browsers and all versions!

but, now you've given me an idea, and I might have to spend some spare time on something like this!! no guarantees tho, it's hard lately to come home from work and do more coding...

g'luck!
^hyd^ is offline   Reply With Quote
Old June 26th, 2002, 01:20 PM     #5 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: So. California, USA
Posts: 2
Smile
Thanks for Replies

Thanks to everyone who replied.

QBall - the reason I can't reasonably use Javascript is that Javascript can't send calls back and forth to the database or to IIS services; I'd have to bring all the data down to the browser before using Javascript to manipulate it, and these drop-downs have a LOT of data in them.

I've considered bringing the whole recordset down to the user's hard drive in an ASCII file and using Javascript to reference the records from there, but there's no way to make this entirely transparent to the end user. At some point, they'd have to agree to let the application write to their hard drive - many probably have their security settings so high that they wouldn't even be prompted to save the file, and some others, when prompted, would deny permission. That's the same challenge I'm facing with creating my own Active X control.

I get requests for this kind of behavior on my select lists all the time. Users seem to think that since it already exists in Access and other Windows apps, it should be very easy to implement in a web app as well. When I ask them if they've ever seen any drop-down behave this way on any website---even a big, commercial site like Amazon or Microsoft---, they acknowledge that no, they've never seen it. Then immediately ask, "Why not?"
april is offline   Reply With Quote
Old June 26th, 2002, 07:20 PM     #6 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
Hmm... I thinking, Java.

Quite easy:
Code:
JComboBox cityBox = new JComboBox()
Also getting data from a text file is easy,

Code:
dataSource = new InputStreamReader(new URL(getDocumentBase(), "recordset.asc").openStream());
strangerstill is offline   Reply With Quote
Old June 27th, 2002, 12:57 AM     #7 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
QBall - the reason I can't reasonably use Javascript is that Javascript can't send calls back and forth to the database or to IIS services; I'd have to bring all the data down to the browser before using Javascript to manipulate it, and these drop-downs have a LOT of data in them.

"can't send calls back and forth to the database or to IIS services; "

There is a simple reason for this. There are basically 2 types of clients:

One that needs a server.
One that needs a server...

oops, both same answer???

There exists no .browser. that will maintain pesistent .DB. connection over .TCP/IP. connection. Ways to fake, btw...

Tried ASP?

Quote:
Note that my select boxes are typically populated from a database, so a Javascript control won't work.

How do you populate your 'drop-downs', my term, into HTML, that your clients can see? Specifics and examples would be nice...
qball is offline   Reply With Quote
Old June 27th, 2002, 11:34 PM     #8 (permalink)
Senior Member
 
Rhino's Avatar
 
Join Date: Oct 2001
Posts: 552
The only possibility I could think of would be to use two controls. A text box right on top of the dd box. If you say you have a way to populate the dd box from yoru recordset, when text is typed into the text box, and therefore changes, restrict the recordset to LIKE "StringInTextBox*". It might be more awkward than them jsut being able to choose from the whole list though.

I'm thinking ASP wasn't really designed to have super long lists.

Is for distribution on a LAN or the internet? If on the net, it would be sweet to have an Active X form resembling a VB form on the page, but maybe they all don't use IE.

If you really need to do this, and its just over a LAN, I would seriously think about making a non-browser app in VB and mailing it to them, making it place a shortcut on their desktop. I know sometimes browser-apps are "neat", but not totally practical.
__________________
It's like that, and it's like this....
Rhino is offline   Reply With Quote
Old June 28th, 2002, 12:09 AM     #9 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
so, you want to re-query the db each time the user types a letter?? why?? seems like a lot of unneeded server processing, imo...

how many items in the listbox are you talking about?? 100? 200? 500? 1000? more??? heck, I'd throw them all in there either way (assuming the limitations of the listbox can handle it!!) then it's done, in one call to the server!

Quote:
I'm thinking ASP wasn't really designed to have super long lists.

as far as i understand it, ASP has nothing to do with controls on a webpage. textboxes, listboxes, buttons etc, are all html form controls. In VB, they are intrinsic (sp?) controls, and afaik, are not 'really' the same, they just look, and for the most part, act the same.

please correct if anything is wrong...

cheers!
^hyd^ is offline   Reply With Quote
Old June 29th, 2002, 12:50 AM     #10 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
so, you want to re-query the db each time the user types a letter?? why?? seems like a lot of unneeded server processing, imo...

would be, iffin using browser as client, an, almost universal client...

Quote:
There is a simple reason for this. There are basically 2 types of clients:

One that needs a server.
One that needs a server...

I'll try to explain.

web browser makes request:
web server takes request:

at this point in time (pit), browser (client), ONLY knows "makes request". This is "One that needs a server.".

most likely find one.

Quote:
One that needs a server...

Try a, PB/VB/C++/java "client", on a network with DB servers.

One can do much more, as one can sustain persitent connections, with both, client and server...
qball is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (36)
Is It Just Me? (2941)
Making Health Care Worse (177)
Wireless Televisions. (12)
CPU fan stops spinning randomly (8)
windows 7 problem (7)
Regular Build (7)
radeon x850xt platinum & shader.. (6)
Is the PSU I received dead? (12)
Print spooler problem (15)
windows vista security holes (10)
HIS HD5770 graphic card question (15)
Dept. of HS: NSA 'Helped' Develop V.. (16)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
EVGA 9800 gtx help with finding a goo.. (10)
Modern Warfare 2: Who Bought It? (62)
windows vista security holes (10)
Internet Lost (2)
Point and Shoot Camera Suggestions. (4)
Regular Build (7)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Laptop with wireless problem. (2)
Hp Artist Edition + Matching Bag (0)
My monitor won't turn on after instal.. (0)
Asus P4G8X Mobo (6)
Xbox 360 GTA: SA disk error (1)
Is the PSU I received dead? (12)
windows 7 internet problem (5)
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)
Have you switched yet? (86)
screen resolution vs monitor size (2)


All times are GMT -4. The time now is 12:52 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28