Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-24-2004, 12:51 PM   #1 (permalink)
fightingillini
Registered User
 
Join Date: Dec 2004
Posts: 5
fightingillini is on a distinguished road
A drop down menu you can type into

I've been looking all over to find a way to create a drop down menu that a user can tab into and type in. If they click the drop down arrow, a menu will drop giving them options if they want. But otherwise they can simply type their selection into it.

Microsoft Outlook has an example of this with their "Find a Contact" menu at the top of the screen.

Does anyone know how this is done?
fightingillini is offline   Reply With Quote
Old 12-24-2004, 01:07 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
there is no html component that will do that. microsoft office is an application of its own.

the closes thing might be to have both a drop down box (select box) and a seperate text field.
__________________
Mike
sde is offline   Reply With Quote
Old 12-24-2004, 01:09 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
well now that i think about it a little more, .. gmail does it.

i think they are using heavy CSS to do it though. it's not exactly an html component that you can just use.
__________________
Mike
sde is offline   Reply With Quote
Old 12-25-2004, 07:20 PM   #4 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
i have some ideas on how to do this, if you can wait about a week or so, i think ill beable to do this.
falsepride is offline   Reply With Quote
Old 12-25-2004, 07:57 PM   #5 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
Hell yes! Screw a week, i got it working in under an hour. Im pretty sure the code below will do what you want. Works in IE, opera, and mozilla.

Code:
<script language="JavaScript">
function prompt_option(obj) {
  if(obj.value == "other") {
    var other= prompt('Please enter ...........', ' ');
    document.forms["form1"].dropdown.options["4"] = null;
    document.forms["form1"].dropdown.options["4"] = new Option(other, other, false, true);
  }
}
</script> 
<form method="" action="" name="form1">
<select size="1" name="dropdown" onChange="prompt_option(this)">
<option value="chioce1">chioce1</option>
<option value="choice2">choice2</option>
<option value="choice3">choice3</option>
<option value="choice4">choice4</option>
<option value="other">other</option>
</select>
falsepride is offline   Reply With Quote
Old 12-26-2004, 09:32 AM   #6 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
i was messing around with the script i wrote and you mite want to run a quick if statement after the prompt to make sure its not null or empty like
Code:
if(other != "" || other != null)  {
falsepride is offline   Reply With Quote
Old 12-26-2004, 11:37 AM   #7 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,166
Belisarius is on a distinguished road
We have a prefectly good example on hand; just click the down arrow next to the "Search" or "Links" section up at the top. Reverse engineer it and boom, you've got exactly what you want.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-26-2004, 11:45 AM   #8 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
wait, fightingillini are you talking about a html form select or something else? because if you meant a html form select, the one i made will work fine with what you want to do.
falsepride is offline   Reply With Quote
Old 12-27-2004, 12:13 PM   #9 (permalink)
fightingillini
Registered User
 
Join Date: Dec 2004
Posts: 5
fightingillini is on a distinguished road
I'm talking about an HTML form. I'm trying to find an example on a web page somewhere that we can use for reference. It would be a regular drop down menu. The only thing that's different is that a user can click on it, like a text box, and type an entry in. Or they could click the menu's down arrow and see the drop down list of options and could choose from one of those.

The menus at the top (search, etc.) aren't what I'm looking for -- sorry.

I'll keep looking around for another example of it -- I know I've seen them a couple places before but the only one I can see right now is the one in MS Outlook. I'll also give the above code a try. Thanks!
fightingillini is offline   Reply With Quote
Old 12-27-2004, 05:07 PM   #10 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
the above code is a normal html select form field. but when the user clicks on the other option in the select, a prompt window opens up and if they type something in the prompt, then it replaces other, with what they typped in the prompt. if this is close to what you want, but not quite explain what you want in good detial, and i know i can do it if it's possible.
falsepride is offline   Reply With Quote
Old 12-27-2004, 06:56 PM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
check out the 'function search' on http://php.net

type in in the text box and you should see a drop down too. i think that is as close as you are gonna get.
__________________
Mike
sde is offline   Reply With Quote
Old 12-29-2004, 08:07 AM   #12 (permalink)
fightingillini
Registered User
 
Join Date: Dec 2004
Posts: 5
fightingillini is on a distinguished road
Thanks for all your help. I'm going to take falsepride's idea back to my user and see what they think or if they want to go a different route -- now that I can tell them that the original idea was missing a couple screws...
fightingillini is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues switching drop down menus creed HTML, XML, Javascript, AJAX 2 11-30-2004 07:15 AM
layout menu form buchannon HTML, XML, Javascript, AJAX 7 11-09-2004 12:08 PM
main menu keystoneman Standard C, C++ 10 11-08-2004 09:03 AM
drop an ip class with iptables sde Linux / BSD / OS X 1 08-23-2004 09:52 PM
Changing variable type for edit box : mfc - .net sde Standard C, C++ 0 01-31-2003 09:53 AM


All times are GMT -8. The time now is 09:05 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting