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

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-05-2012, 09:27 AM   PM User | #1
ChLi
New to the CF scene

 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ChLi is an unknown quantity at this point
Combo Boxes - more than 2 boxes possible?

Hello together,

is it possible to create more than 2 boxes with the javascript "CUT & PASTE DOUBLE COMBO"? My target is a produktfinder, therefore our visiter have to answer in the first step 4 questions, than he get the right produkt.

It would be nice to hear from you - tanks for help!

Greatings
Chris
ChLi is offline   Reply With Quote
Old 11-05-2012, 09:58 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Not a million miles from here:-

http://www.javascriptkit.com/script/...plecombo.shtml

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-05-2012, 06:47 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
You'd do better to use select lists rather than combo boxes for product selection - that way they have to select a product you actually have rather than being able to type anything they like into the combobox.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 11-05-2012, 07:18 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by felgall View Post
You'd do better to use select lists rather than combo boxes for product selection - that way they have to select a product you actually have rather than being able to type anything they like into the combobox.
I understood that the questioner desired select lists, which is what the script I mentioned provides.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-05-2012, 08:58 PM   PM User | #5
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Philip M View Post
I understood that the questioner desired select lists, which is what the script I mentioned provides.
I realise that. The point I was trying to make is that there is a difference between a select list and a combo box. The person asking the question was asking about completelty the wrong form element.

The HTML for a select list and the HTML for a combo box are completely different apart from both having option tags to define the pre-defined options you can select from.

Select List:

Code:
<select name="statesel" id="state">
<option value=" " selected="selected"> </option>
<option value="ACT">ACT</option>
<option value="NSW">NSW</option>
<option value="NT">NT</option>
<option value="QLD">QLD</option>
<option value="SA">SA</option>
<option value="TAS">TAS</option>
<option value="VIC">VIC</option>
<option value="WA">WA</option>
<option value="OS">overseas</option>
</select>
Combo Box:

Code:
<input type="text" list="state">
<datalist id="state">
<option value="act">
<option value="nsw">
<option value="nt">
<option value="qld">
<option value="sa">
<option value="tas">
<option value="vic">
<option value="wa">
</datalist>
Also they function quite differently (with these examples you'd have to select 'overseas' from the select list if you don't want to select an Australian state whereas with the combo box you'd simply enter the name of the state you are in instead of selecting it). So it is difficult to understand how pople can possibly get the two confused.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 11-05-2012, 09:58 PM   PM User | #6
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 976
Thanks: 0
Thanked 203 Times in 198 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by felgall View Post
I realise that. The point I was trying to make is that there is a difference between a select list and a combo box. ...
Combo Box:

Code:
<input type="text" list="state">
<datalist id="state">
<option value="act">
<option value="nsw">
<option value="nt">
<option value="qld">
<option value="sa">
<option value="tas">
<option value="vic">
<option value="wa">
</datalist>
So it is difficult to understand how pople can possibly get the two confused.
The <datalist> tag is new in HTML5, the term "combobox" isn't. The term and its functionality may well have been in long-term use with other languages.
Logic Ali is offline   Reply With Quote
Old 11-05-2012, 10:04 PM   PM User | #7
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
I am afraid that I have always considered double combo and multiple (double) select lists as synonyms.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-06-2012, 01:59 PM   PM User | #8
ChLi
New to the CF scene

 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ChLi is an unknown quantity at this point
Hello again,

thanks for your help.

Philip M: Thanks for your link, i will try it at first with 3 opportunitis for our visitors. Perhaps it is better so, becouse 4 boxes also take extremly much work.

Have a good time.
ChLi is offline   Reply With Quote
Old 11-06-2012, 03:42 PM   PM User | #9
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by ChLi View Post
Hello again,

thanks for your help.

Philip M: Thanks for your link, i will try it at first with 3 opportunitis for our visitors. Perhaps it is better so, becouse 4 boxes also take extremly much work.
Yes, extremly much work! But perfectly possible of course.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-06-2012, 06:18 PM   PM User | #10
Calvert Tripesi
New Coder

 
Join Date: Jan 2011
Posts: 51
Thanks: 0
Thanked 9 Times in 9 Posts
Calvert Tripesi is an unknown quantity at this point
Quote:
Originally Posted by ChLi View Post
Hello together,

is it possible to create more than 2 boxes with the javascript "CUT & PASTE DOUBLE COMBO"? My target is a produktfinder, therefore our visiter have to answer in the first step 4 questions, than he get the right produkt.
If you find array-building too imponderable, you could evaluate this script: http://scripterlative.com/files/selectcascade.htm, which in the event that you cannot use a server-side database, lets you use XML blocks to store/retrieve the option data.
Calvert Tripesi is offline   Reply With Quote
Old 11-06-2012, 08:28 PM   PM User | #11
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Logic Ali View Post
The <datalist> tag is new in HTML5, the term "combobox" isn't. The term and its functionality may well have been in long-term use with other languages.
Yes. HTML 5 is introducing the missing combo box form field into web pages. It has been available in other programming languages used for creating desktop applications since the introduction of Windows 3.0 (from my personal knowledge) and possibly a lot earlier.

The whole reason why it has always been called a combo box is because it COMBINES the functionality of an input field and a dropdown list into a single form field.

When I first started writing web pages back in 1999 the combo box field was one that I could see several uses for but where there was at that time no easy way to implement it. The only way was to display two fields where JavaScript updated the input field if something was selected in the select list. The introduction of the DOM made it possible to use JavaScript to combine an input field and a list to produce a combo box that works with JavaScript enabled and which appears as just an input field when JavaScript isn't available. HTML 5 is finally introducing a way to create a combo box using just HTML - something that should have been added to HTML at the same time the <form> tag was added - since all other languages had combo box elements available to use in forms.

A combo box is DEFINITELY NOT a synonym for a drop down list as a drop down list only provides half the functionality of a combo box.

The term combo box for a combination of input field and dropdown list into a single form field long predates the introduction of the web - it is just that the web hasn't provided an easy way to define a combo box prior to HTML 5.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 11-06-2012 at 08:31 PM..
felgall is offline   Reply With Quote
Old 11-06-2012, 08:31 PM   PM User | #12
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by felgall View Post
Yes. HTML 5 is introducing the missing combo box form field into web pages. It has been available in other programming languages used for creating desktop applications since the introduction of Windows 3.0 (from my personal knowledge) and possibly a lot earlier.

The whole reason why it has always been called a combo box is because it COMBINES the functionality of an input field and a dropdown list into a single form field.

When I first started writing web pages back in 1999 the combo box field was one that I could see several uses for but where there was at that time no easy way to implement it. The only way was to display two fields where JavaScript updated the input field if something was selected in the select list. The introduction of the DOM made it possible to use JavaScript to combine an input field and a list to produce a combo box that works with JavaScript enabled and which appears as just an input field when JavaScript isn't available. HTML 5 is finally introducing a way to create a combo box using just HTML - something that should have been added to HTML at the same time the <form> tag was added - since all other languages had combo box elements available to use in forms.

A combo box is DEFINITELY NOT a synonym for a drop down list as a drop down list only provides half the functionality of a combo box.
OK, but HTML5 is still some way from implementation and it will be quite a few years before HTML4 browsers are extinct.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-06-2012, 08:40 PM   PM User | #13
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Philip M View Post
OK, but HTML5 is still some way from implementation and it will be quite a few years before HTML4 browsers are extinct.
As I said, since the introduction of the DOM it has been possible to create a combo box using an input field and a list using HTML 4 - see http://javascriptexample.net/domform11.php

Prior to the introduction of the DOM the closest you could get (for browsers such as Netscape 3 and 4) was to use both an input field and a dropdown list and link them together - http://javascript.about.com/library/blnav7.htm shows how I created combo box fields in web forms back in 2002 through 2005.

I'd been using combo boxes in desktop applications in the early 1990s and so that such an element hasn't existed in HTML prior to HTML 5 is something that I have always found to be annoying - hence the above two solutions that I implemented in my forms.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall 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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:32 PM.


Advertisement
Log in to turn off these ads.