Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 13th, 2005, 01:36 AM
moluu1 moluu1 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 2 moluu1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 41 sec
Reputation Power: 0
Need Help - Asp 2 Dropdown Box Onchange

Hi
Can anybody show me how to do 2 dropdown boxes which the second box will change the value according to the first drop box selection?
I succesfully made the value change but the first drop box also changed to its initial value.

Thanks in advance
the attachment is my code..
Attached Files
File Type: zip maintainHardware.zip (9.8 KB, 328 views)

Reply With Quote
  #2  
Old September 13th, 2005, 01:38 AM
Guddu's Avatar
Guddu Guddu is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2005
Location: Oxford UK
Posts: 2,980 Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Months 1 Week 6 Days 11 h 23 m 35 sec
Reputation Power: 463
post ur code pls........

Reply With Quote
  #3  
Old September 13th, 2005, 01:44 AM
moluu1 moluu1 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 2 moluu1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 41 sec
Reputation Power: 0
here is my code...happy to tell me wat wrong with it.

This is part of the code ""
sqlManufac = "SELECT * from category order by category_id"
if ProdTypeID = 0 then
sqlSubCat = "SELECT * from sub_category order by sub_category_name"
else
sqlSubCat = "Select * from sub_category where ProductTypeID = " + prodTypeId + " order by sub_category_id"

end if

response.write(sqlSubCat)


sqlCat = "SELECT * from product_type order by producttypeid"
If cmd = "Add" Then
sql = "select * from Product where Product_id = 0"
Else
sql = "select * from Product where Product_id = " & productID
sql1 = "select * from Hardware_dimension where Product_id = " & productID
Set rsDim = objConn.Execute(sql1)
End If

' Get a Record Set
set rsSubcat = objConn.Execute(sqlSubCat)
Set rsCat = objConn.Execute(sqlCat)
set rsManufac = objConn.Execute(sqlManufac)
Set rs = objConn.Execute(sql)

if (isnull(mainCatDesc) or mainCatDesc = "" ) and cmd <> "Add" then
Do Until rsManufac.eof
If rs("category_id") = rsManufac("category_id") Then
mainCatDesc = rsManufac("category_name")
catDescription = rsManufac("category_desc")
End If
rsManufac.movenext
loop
rsManufac.movefirst
end if

if (isnull(mainProdDesc) or mainProdDesc = "" )and cmd <> "Add" then
Do Until rsCat.eof
If rs("producttypeid") = rsCat("producttypeid") Then
mainProdDesc = rsCat("producttypename")
prodDescription = rsCat("producttype_desc")
End If
rsCat.movenext
loop
rsCat.movefirst
end if

'mainProdDesc

If cmd = "Add" Then %>
<form name="form1" method="post" action="maintainHardware.asp" onSubmit="return hardwareValidate()" enctype="multipart/form-data">
<input type="hidden" name="cmd" value="add_save">
<% ElseIf cmd = "Edit" Then %>
<form name="form1" method="post" action="maintainHardware.asp" onSubmit="return hardwareValidate()" enctype="multipart/form-data">
<input type="hidden" name="cmd" value="edit_save">
<input type="hidden" name="productID" value=<%=productID%>>
<input type="hidden" name="imagePath" value='<%=rs("Product_Image")%>'>
<input type="hidden" name="pdfPath" value='<%=rs("Product_pdf")%>' ID="Hidden7">
<% ElseIf cmd = "Delete" Then %>
<form name="form1" method="post" action="maintainHardware.asp">
<input type="hidden" name="cmd" value="delete_save">
<input type="hidden" name="productID" value=<%=productID%>>
<input type="hidden" name="imagePath" value='<%=rs("Product_Image")%>'>
<% ElseIf cmd = "View" Then %>
<form name="form1" method="post" action="searchHardware.asp">
<input type="hidden" name="cmd" value="View">
<% End If %>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table class=content border="5" width="654" cellspacing="0" cellpadding="0" height="280" align="center">
<tr class=contentrow1 align="center">
<td colspan="9" height="22"><b><%=cmd %> Hardware Product</b></td>
</tr>
<tr class=contentrow2 >
<td colspan="9" height="260">

<table class=record width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="30" height="33">&nbsp;</td>
<td width="82" height="33" align="right"><div align="right"><font size="-1"><strong>Product Type</strong></font></div></td>
<td width="16" height="33" align="center"><font size="-1"><strong> :</strong></font></td>
<td valign="center" height="33" colspan="4">
<%

Select Case cmd
Case "Add" %>

<select name="prodtype" onchange="window.location='maintainHardware.asp?cmd=Add&cid=' + document.forms[0].prodtype.options[document.forms[0].prodtype.selectedIndex].value">

<% Do Until rsCat.eof
If rsCat("producttype_desc") = mainCatDesc Then %>
<option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%> selected><%=rsCat("producttypename")%></option>
<% Else %>
<option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%>><%=rsCat("producttypename")%></option>
<% End If
rsCat.movenext

loop

Reply With Quote
  #4  
Old September 13th, 2005, 02:08 AM
Guddu's Avatar
Guddu Guddu is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2005
Location: Oxford UK
Posts: 2,980 Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Guddu User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Months 1 Week 6 Days 11 h 23 m 35 sec
Reputation Power: 463
try this........
<% Do Until rsCat.eof
If rsCat("producttype_desc") = mainCatDesc Then %>
<option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%> if rsCat("producttypeid")=cid then response.write "selected"><%=rsCat("producttypename")%></option>
<% Else %>
<option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%>if rsCat("producttypeid")=cid then response.write "selected"><%=rsCat("producttypename")%></option>
<% End If
rsCat.movenext

loop

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Asp 2 Dropdown Box Onchange


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway