Newbie

W

winstontuck

Hi GUys

I am new to javascript and would like to know if the following is
possible:

I want to create a dropdown and place a text input(editbox) on top of
that dropdown in such a way that only the dropdown arrow shows. What
I am actually trying to achieve is to have a dropdownbox in which the
user can type in its own value if not in the drop down list.

thanks
 
E

Evertjan.

wrote on 07 jul 2006 in comp.lang.javascript:
Hi GUys

I am new to javascript and would like to know if the following is
possible:

I want to create a dropdown and place a text input(editbox) on top of
that dropdown in such a way that only the dropdown arrow shows. What
I am actually trying to achieve is to have a dropdownbox in which the
user can type in its own value if not in the drop down list.

Impossible.

What ia a dropdown arrow?
 
T

Tom Davis

Evertjan. said:
Impossible.

What ia a dropdown arrow?

This isn't really impossible at all, you just can't use the standard
html <select> box to do it if you want the input box covering the
dropdown. Actually with some creative positioning you might even be
able to do that, but I don't know how (if at all) usable it would be.
Basically, the gist of it is this: have an input box that has a
listener on the form button (or just wait for ENTER), it then appends
whatever you put there into an "invisible" div that will appear when
you click on the select dropdown arrow, then add a listener on the list
elements so you know which was clicked, or make them submit a form.

So to answer your questions, yes it is possible.
 
E

Evertjan.

Tom Davis wrote on 08 jul 2006 in comp.lang.javascript:
This isn't really impossible at all, you just can't use the standard
html <select> box to do it if you want the input box covering the
dropdown. Actually with some creative positioning you might even be
able to do that, but I don't know how (if at all) usable it would be.
Basically, the gist of it is this: have an input box that has a
listener on the form button (or just wait for ENTER), it then appends
whatever you put there into an "invisible" div that will appear when
you click on the select dropdown arrow, then add a listener on the list
elements so you know which was clicked, or make them submit a form.

So to answer your questions, yes it is possible.

Cross browser? I doubt it.

What is a dropdown arrow?
 
R

Randy Webb

Tom Davis said the following on 7/7/2006 6:02 PM:
This isn't really impossible at all,

Yes it is.
you just can't use the standard html <select> box to do it if you want
the input box covering the dropdown.

Actually with some creative positioning you might even be able to do that,
but I don't know how (if at all) usable it would be.

Considering that a <select> is a windowed component in IE and that
z-index has no effect on it, what you are saying might be possible is in
fact impossible.
Basically, the gist of it is this: have an input box that has a
listener on the form button (or just wait for ENTER), it then appends
whatever you put there into an "invisible" div that will appear when
you click on the select dropdown arrow, then add a listener on the list
elements so you know which was clicked, or make them submit a form.

Show some actual sample code that attempts to do what you are implying
might be able to be done.
So to answer your questions, yes it is possible.

No, it's not.

What is a "dropdown arrow" though?
 
T

TheBagbournes

Jim said:
(e-mail address removed) wrote in @m79g2000cwm.googlegroups.com:


Perhaps you are thinking of a "Combo Box" which some GUIs use. It allows
the user to either select an item from the dropdown menu, or type text
into a text box. JavaScript doesn't have a built-in Combo Box control.
It's debatable whether you can create one using other JS controls.

Of course you can create a control to do this. The <select> z-index problem is an IE6 bug.

You could develop a good control easily with http://developer.yahoo.com/yui/ which has good cross-browser capabilities.
 
L

Lasse Reichstein Nielsen

[Combo box]
Prove it.

The examples of successful combo boxes I have seen have not used
select controls (and my feeble attempts at doing so all failed
miserably). The control is possible, but the implementation strategy
(using a combination of text control and select control) is unlikely
to work, especially across different browser (where the "down arrow
button" will probably have different widths, and there is no way to
find it).
Nonsense.

Do you really miss Thomas this much? :)

It's true that the problem exists in other browsers than IE too.
Whether it's a bug or a feature, I'll leave to the philosophers.

/L
 
R

Randy Webb

Lasse Reichstein Nielsen said the following on 7/8/2006 1:51 PM:
[Combo box]
Prove it.

The examples of successful combo boxes I have seen have not used
select controls (and my feeble attempts at doing so all failed
miserably). The control is possible, but the implementation strategy
(using a combination of text control and select control) is unlikely
to work, especially across different browser (where the "down arrow
button" will probably have different widths, and there is no way to
find it).
Nonsense.

Do you really miss Thomas this much? :)

Ugggh....

Point made though.
It's true that the problem exists in other browsers than IE too.

That was precisely my point. Not well made but that was the point. It is
in IE4+ IIRC.
Whether it's a bug or a feature, I'll leave to the philosophers.

Ditto.
 
K

Kevin Darling

I want to create a dropdown and place a text input(editbox) on top of
that dropdown in such a way that only the dropdown arrow shows. What
I am actually trying to achieve is to have a dropdownbox in which the
user can type in its own value if not in the drop down list.

Two seconds of Googling found several attempts at creating an HTML
combo box. The best one seems to be at:

http://particletree.com/features/upgrade-your-select-element-to-a-combo-box/

Cheers,
Kev
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sat, 8 Jul 2006
19:51:05 remote, seen in Lasse Reichstein
Nielsen said:
Do you really miss Thomas this much? :)

Now would be a good time to kill-rule Thomas Lahn, since if he returns
he'll probably post several thousand articles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,797
Messages
2,569,647
Members
45,377
Latest member
Zebacus

Latest Threads

Top