Drop down list in combination with new entry option

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Mephisto
Forum Newbie
Posts: 4
Joined: Thu Oct 10, 2002 5:04 pm
Location: North Germany
Contact:

Drop down list in combination with new entry option

Post by Mephisto »

Hi,

in a form for entering site news I use a drop down list like this:

<select name="topic" size="1" maxlength="24">
<option>Web Design</option>
<option>Home Cinema</option>
<opton>Unreal Tournament</option>
</select>

Using this HTML codes it is not possible to enter new topics, I can only select one of the predefined.

Is there any "HTML control" which allows the input of new values as well as selected one out of a list of predefined ones?

Ciao, Meph
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

no there isn't. what you could do though is make a seperate text input box for people to write there own topic name. then in the select box make an option read "Other... (specify below)". then if that value is selected you'll know to use the custom value.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

nope

Post by phpScott »

the best way to deal with this is to generate the select box out of a database which can be updates as people enter more possible options.
How this would be implemented of course depends on what you are trying to do with the select list.

php and databases oh my oh my what more fun could you ask for. :D

phpScott
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

with DHTML you can create an input-text field that overlays the dropdown.
I did this once but it was far from reliable and not worth the whole scripting
User avatar
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Post by Crashin »

I also needed something similar and ended up with a PHP/MySQL system. If the end user needed something that wasn't in the list they added to the table, and it was included in the list thereafter. But, it gets more complicated if you need the lists to be user specific. 8)
Post Reply