Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 47 votes, 3.30 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2004, 05:54 PM   PM User | #1
SlySecretSpy
New Coder

 
Join Date: Nov 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
SlySecretSpy is an unknown quantity at this point
Basic Editable Combo Box

http://www.portalaska.com/combo.html

http://www.portalaska.com/combo.js

Here is a very basic simulated editable combo box for quick and dirty uses.

After any text input on a form you simply add a...

<script>fancycombo("[inputid]combo","[inputid]","[option1]","[option2]","[option3]")</script>

You must give the input an id as well as a name. They don't have to be the same thing, but its recommended.

NS broke when I was cleaning up the code. Searching for the error.

Last edited by SlySecretSpy; 01-29-2004 at 06:10 PM..
SlySecretSpy is offline   Reply With Quote
Old 01-29-2004, 06:00 PM   PM User | #2
Vladdy
Senior Coder

 
Join Date: Jun 2002
Location: Nashua, NH
Posts: 1,724
Thanks: 0
Thanked 0 Times in 0 Posts
Vladdy is an unknown quantity at this point
Thumbs down

Does not work in Gecko
__________________
Vladdy | KL
"Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"
Vladdy is offline   Reply With Quote
Old 01-29-2004, 06:17 PM   PM User | #3
SlySecretSpy
New Coder

 
Join Date: Nov 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
SlySecretSpy is an unknown quantity at this point
Sweet, I have a major design flaw that I found. Doesn't work in gecko. Positioning is off.

Last edited by SlySecretSpy; 01-29-2004 at 06:20 PM..
SlySecretSpy is offline   Reply With Quote
Old 01-29-2004, 06:18 PM   PM User | #4
Choopernickel
Regular Coder

 
Join Date: Apr 2003
Location: Atlanta, GA
Posts: 487
Thanks: 0
Thanked 0 Times in 0 Posts
Choopernickel is an unknown quantity at this point
Have you tried the TypeAheadCombo class I developed based on some great work by glenngv? It just uses a normal <select> element, and can accept a single new value as the first option.

Check it out; it may do the trick you're looking for.
Choopernickel is offline   Reply With Quote
Old 02-12-2004, 05:51 PM   PM User | #5
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
I haven't done much work with HTC's (Hyper Text Components), but I found a pretty sweet component that does exactly what you're thinking of, but it looks really nice too.

Here's the link:
http://www.deadbeef.com/dhtml/combobox.htm

I'm currently trying to figure out how to incorporate another feature of the select component: the value attribute of each option. When used in a form, this HTC seems to merely pass the value of text in the variable on submit -- treating it just like a textbox.

I don't know if there is a fix for this, but one would be much appreciated.

Thanks & Enjoy,
Sadiq.
sad69 is offline   Reply With Quote
Old 02-13-2004, 02:40 AM   PM User | #6
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
The problem with that code is that it only works in IE so it has very limited support. Unlike the update that Choopernickel made in my original work, which has a wider support (IE5+, NS6+, Moz1+ among others)
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 02-13-2004, 03:11 AM   PM User | #7
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
I suppose...

But I'm currently creating an application for a company that will run on its intranet, and all machines are windows -- hence, all users will use IE to connect to the application.

In my environment, presentation is very key, and this HTC provides almost exactly what I'm looking for. Except, of course, the fact that it's missing the value attribute...

But I do see your point. However, if you can guarantee your users will be using IE, this is a very nice option.

Again, if anyone can figure out how to get the value attribute of the select box to carry through, I'd really appreciate your help.

Thanks,
Sadiq.
sad69 is offline   Reply With Quote
Old 02-13-2004, 03:47 AM   PM User | #8
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
It is said in the link you posted that you access the value in javascript as:

name_text.value

But if you mean, it doesn't pass the selected option value in the server, the html source of that page does specify the value, though the same with the text.

<form id=form1>
<DEADBEEF:COMBOBOX size="44" name="server" id=server>
<option selected value="deadbeef.com">deadbeef.com
<option value="microsoft.com">microsoft.com
<option value="sageconspiracy.com">sageconspiracy.com
</DEADBEEF:COMBOBOX>
<br><input type=submit>(Look at the url in your address bar after you press submit.)
</form>
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app

Last edited by glenngv; 02-13-2004 at 03:53 AM..
glenngv is offline   Reply With Quote
Old 02-13-2004, 05:16 AM   PM User | #9
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
I don't get it..

My problem is that the variable passed over to my php page doesn't hold the value, it holds the text.

So yea, I'm sure that using Javascript I could see the value, however, once the form is submitted to the server, the variable in the $_POST array holds the text value -- NOT the value.

Now I'm not sure if you answered my question in your previous post glenngv, but I hope I've made my problem more clear.

Thanks again,
Sadiq.
sad69 is offline   Reply With Quote
Old 02-16-2004, 02:08 AM   PM User | #10
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Ok, if that is the case then just create a hidden field that will hold the value of the selected option. Since javascript can access the "value", you can set the value of the hidden field when the submit button is clicked and then in PHP, access that hidden field instead of the combobox itself.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 02-16-2004, 02:53 AM   PM User | #11
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
glenngv,

thanks for your short-circuit solutions. However, I'm going to need a proper solution since my application is slightly more complicated (dynamic variables and form elements...), and the short-circuit solutions won't work.

I've contacted the guy from deadbeef.com to see if he can aid me.

If anyone else has any experience with HTCs, I'd appreciate your help as well.

Thanks,
Sadiq.
sad69 is offline   Reply With Quote
Old 02-17-2004, 01:54 PM   PM User | #12
Choopernickel
Regular Coder

 
Join Date: Apr 2003
Location: Atlanta, GA
Posts: 487
Thanks: 0
Thanked 0 Times in 0 Posts
Choopernickel is an unknown quantity at this point
You have two cares, apparently: functionality and presentation. These are of course good cares to have- yet you must decide which of the two is most important.

TypeAheadCombo will submit the <option> value, either if it is not enabled to accept new values, or if a new value is not typed. If a new value is typed, there's only one context which must be dealt with: the new <option>'s text, which is set to the same as the value, as the typing happens.

If your primary concern is a flashing cursor, I'm sure somebody can come up with a way to add one in to the TypeAheadCombo class.

Here's a quite complex form with TypeAheadCombo in action, and the instantiation is (of course) no more difficult than ever: http://www.10mar2001.com/temp/formUI/index.html . There's no form too complex for this script.
Choopernickel is offline   Reply With Quote
Old 02-17-2004, 05:44 PM   PM User | #13
SlySecretSpy
New Coder

 
Join Date: Nov 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
SlySecretSpy is an unknown quantity at this point
Or, you could code your own and get an education in the proccess. My code barely works in general, but on my IE platform and design it works great. If I have time become available, I'll modify it for cross compliance.
SlySecretSpy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:24 PM.


Advertisement
Log in to turn off these ads.