Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2004, 11:28 AM
Authorized User
 
Join Date: Jul 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default conditional drop down list....

I am trying to make the second drop down list dependant on the selection of the first one. My question is this. What is the syntax for adding options to the second list later after the user has selected something in the first list.

can anyone give me the code in asp for the same???

 
Old July 18th, 2004, 11:39 PM
Authorized User
 
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to use javascript or other "client-side" method, as ASP cannot do anything more once the html has been sent to the browser.

This may be what you want:

<script language="JavaScript1.2">

 function selectCombo() {
 var aa;
 var s,ss;
 var s = myForm1.selectitem1.value;
 ss = s.split("&");
 for (i = 0; i < ss.length ; i++) {
 myForm1.selectitem2.options[i].text = ss[i];
 }
 }
 </SCRIPT>
 <form name=myForm1 >

<SELECT id=selectitem1 name=selectitem1 style="HEIGHT: 66px; LIST-STYLE: square; WIDTH: 155px" dataFld="" onChange=selectCombo()>
<option value= Item1-1&Item1-2&Item1-3>Item 1</option>
<option value= Item2-1&Item2-2&Item2-3>Item 2</option>
<option value= Item3-1&Item3-2&Item3-3>Item 3</option>
</select>

<SELECT id=selectitem2 name=selectitem2 style="HEIGHT: 66px; LIST-STYLE: square; WIDTH: 155px" dataFld="" >
 <OPTION value=>Item1-1</option>
 <OPTION value=>Item1-2</option>
 <OPTION value=>Item1-3</option>
</select>
</form>
 
Old July 25th, 2004, 01:56 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tontos
Default

check this site :

http://www.atgconsulting.com/doublelist.asp

"Podes dizer-me, por favor, que caminho devo tomar para sair daqui ?", perguntou Alice
"Isso depende muito para onde quiseres ir", respondeu o Gato.
"Não me interessa muito para onde...", disse Alice
"Então não importa qual o caminho que tomas", respondeu o Gato.





Similar Threads
Thread Thread Starter Forum Replies Last Post
drop down list ashu_gupta75 Excel VBA 1 October 15th, 2007 05:52 PM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Drop Down List Beginner123 VB How-To 2 March 7th, 2005 01:56 PM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 8 September 16th, 2004 07:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.