Forums
This topic is locked
Drop Down Boxes
05 Dec 2002 14:02:35 Lee Smith posted:
I would like to have two drop down boxes on a form so that when the user selects a value from the first drop down box, it gives them a diffent set of values to select from in the second drop down box. If you look at the autotrader, www.autotrader.co.uk, website for example, when you select Audi form the Manufacturer Drop down box, you then get a list of the cars that are made by Audi in the Model drop down box.
Any help is greatly appreciated.
Lee Smith
Replies
Replied 05 Dec 2002 22:12:25
05 Dec 2002 22:12:25 Dave Blohm replied:
there are various ways to do this...the EASIEST way is to use show/hide layer JavaScript Behaviors already built into DW...
If you need further help let me know...
Doc
Rangewalk Digital Studios
If you need further help let me know...
Doc
Rangewalk Digital Studios
Replied 06 Dec 2002 04:37:33
06 Dec 2002 04:37:33 LiToZ LiToZ replied:
ummm... there is a very easy JS for doing that using arrays which is really easy to understand and easy to be used... here you go the code, guess it is self explaining <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Technology Sites</option>
<option>News Sites</option>
<option>Search Engines</option>
</select>
<select name="stage2" size="1">
<option value="wsabstract.com">Website Abstraction</option>
<option value="www.news.com">News.com</option>
<option value="www.wired.com">Wired News</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com)
Over 200+ free JavaScripts here!
*/
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Website Abstraction","wsabstract.com")
group[0][1]=new Option("News.com","www.news.com")
group[0][2]=new Option("Wired News","www.wired.com")
group[1][0]=new Option("CNN","www.cnn.com")
group[1][1]=new Option("ABC News","www.abcnews.com")
group[2][0]=new Option("Hotbot","www.hotbot.com")
group[2][1]=new Option("Infoseek","www.infoseek.com")
group[2][2]=new Option("Excite","www.excite.com")
group[2][3]=new Option("Lycos","www.lycos.com")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
Dats all.... hope that meets what ya want <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Technology Sites</option>
<option>News Sites</option>
<option>Search Engines</option>
</select>
<select name="stage2" size="1">
<option value="wsabstract.com">Website Abstraction</option>
<option value="www.news.com">News.com</option>
<option value="www.wired.com">Wired News</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com)
Over 200+ free JavaScripts here!
*/
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Website Abstraction","wsabstract.com")
group[0][1]=new Option("News.com","www.news.com")
group[0][2]=new Option("Wired News","www.wired.com")
group[1][0]=new Option("CNN","www.cnn.com")
group[1][1]=new Option("ABC News","www.abcnews.com")
group[2][0]=new Option("Hotbot","www.hotbot.com")
group[2][1]=new Option("Infoseek","www.infoseek.com")
group[2][2]=new Option("Excite","www.excite.com")
group[2][3]=new Option("Lycos","www.lycos.com")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
Dats all.... hope that meets what ya want <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 06 Dec 2002 08:35:20
06 Dec 2002 08:35:20 sup ert replied:
Hi!
I got this a few days ago from another 'Guru' on these TalkZones. I tried no. 2 and it works fine.
-------------
There are two ways of achieving this:
1. Filter the second recordset by a common value in the first. This does require the page to refresh though and that can be annoying for the user if they have already entered data into the form.
Here is a link to achieve no.1
www.dmxzone.com/showDetail.asp?TypeId=2&NewsId=3218
2. This is my prefered way and as you say it does require javascript:
Here is a link for no.2
www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listbox.htm
Regards
Vince
I got this a few days ago from another 'Guru' on these TalkZones. I tried no. 2 and it works fine.
-------------
There are two ways of achieving this:
1. Filter the second recordset by a common value in the first. This does require the page to refresh though and that can be annoying for the user if they have already entered data into the form.
Here is a link to achieve no.1
www.dmxzone.com/showDetail.asp?TypeId=2&NewsId=3218
2. This is my prefered way and as you say it does require javascript:
Here is a link for no.2
www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listbox.htm
Regards
Vince
Replied 06 Dec 2002 10:15:09
06 Dec 2002 10:15:09 Lee Smith replied:
Thanks for all of your help guys. I shall give all of the suggestions a go and let you know how I get on.
Lee Smith
Lee Smith