JMH save me!!!
I have this double depended dropdown and I want to add a third one
Code:
<%
Dim rsProduct, str_sql
str_sql = "SELECT company, productid, product, kostos, timi_polisis, typefn, typeid, producttype " & _
"FROM companies, products, producttypes where companyid = companyfn and typeid = typefn order by company, product"
Set rsProduct = my_conn.Execute(str_sql)
%>
<script language="javascript">
var dataArray = new Array(null<%
If Not rsProduct.EOF Then rsProduct.MoveFirst
Dim last_item
Do Until rsProduct.EOF
If last_item <> rsProduct("company") Then
If len(last_item) > 0 Then Response.Write ")"
Response.Write ",new Array(null"
last_item = rsProduct("company")
End If
Response.Write ",new Array('" & rsProduct("productid") & "','" & rsProduct("product") & "','" & rsProduct("kostos") &"','" & rsProduct("timi_polisis") &"','" & rsProduct("producttype") & "')"
rsProduct.MoveNext
Loop
If len(last_item) > 0 Then Response.Write ")"
%>);
function changeOptions(elemOne,elemTwo){
for(i = elemTwo.options.length; i >= 1; i--)
elemTwo.options[i] = null;
elemTwo.selectedIndex = 0;
if(elemOne.selectedIndex == 0)
return false;
for(i=1;i<dataArray.length;i++){
elemTwo.options[i] = new Option(dataArray[elemOne.selectedIndex][i][1],dataArray[elemOne.selectedIndex][i][0]);
}
}
<select name="selCompany" class="dropdown" onChange="changeOptions(this,document.getElementsByName('sel Product')[0])">
<option value="">[ Επιλέξτε εταιρία ]</option>
<%
If Not rsProduct.BOF Then rsProduct.MoveFirst
Dim last_company
Do Until rsProduct.EOF
If rsProduct("company") <> last_company Then
Response.Write "<option>" & rsProduct("company") & "</option>"
last_company = rsProduct("company")
End If
rsProduct.MoveNext
Loop
%>
</select>
<select class="dropdown" name="selProduct">
<option value="">[ Επιλέξτε Προϊόν ]</option>
</select>
I have tried it but I can't..
Please! You'll be my hero!
