Hi,
I have a form which has various text fields that can be filled in. I also have three drop down menus which are all linked. Department, Category and Subcategory. The idea is that if you choose a certain department you can only see certain categories and if you choose certain categories you can only see certain subcategories.
Originally I tried to do it by building a recordset then using javascript to do the rest but I didn't really know what I was doing so gave up on that approach.
The way I have gone now is to use onClick="submit()" so that when you select an option it posts to the same page then builds the other menus accordingly so for example to build the categories menu we look at what the department has been set to (DocsDeptMenu)
<%
TBL.Open "SELECT DocsCatID, DocsCat FROM DocsCat WHERE DocsCat.DocsDept=" & DocsDeptMenu, DB
%>
<select name="DocsCat" onClick="submit()">
<option value="0">Select Category</option>
<%
Do While Not TBL.EOF
%>
<option <%
If INT(Request.Form("DocsCat"))=TBL("DocsCatID") Then
Response.Write("SELECTED")
CatOption=TRUE
End If
%> value="<% = TBL("DocsCatID") %>"><% = TBL("DocsCat") %></option>
<%
TBL.MoveNext
Loop
TBL.Close
%>
</select>
This works fine to an extent but because this is a form in its own right I have to put it at the start of the page as I can't have a <form></form> within a form whereas ideally I would like the form layout to be different with the document title and the author first then the user selects the department, category etc.
Is there any way round this using my approach or will I have to do it all client side?
cheers
Ed
I have a form which has various text fields that can be filled in. I also have three drop down menus which are all linked. Department, Category and Subcategory. The idea is that if you choose a certain department you can only see certain categories and if you choose certain categories you can only see certain subcategories.
Originally I tried to do it by building a recordset then using javascript to do the rest but I didn't really know what I was doing so gave up on that approach.
The way I have gone now is to use onClick="submit()" so that when you select an option it posts to the same page then builds the other menus accordingly so for example to build the categories menu we look at what the department has been set to (DocsDeptMenu)
<%
TBL.Open "SELECT DocsCatID, DocsCat FROM DocsCat WHERE DocsCat.DocsDept=" & DocsDeptMenu, DB
%>
<select name="DocsCat" onClick="submit()">
<option value="0">Select Category</option>
<%
Do While Not TBL.EOF
%>
<option <%
If INT(Request.Form("DocsCat"))=TBL("DocsCatID") Then
Response.Write("SELECTED")
CatOption=TRUE
End If
%> value="<% = TBL("DocsCatID") %>"><% = TBL("DocsCat") %></option>
<%
TBL.MoveNext
Loop
TBL.Close
%>
</select>
This works fine to an extent but because this is a form in its own right I have to put it at the start of the page as I can't have a <form></form> within a form whereas ideally I would like the form layout to be different with the document title and the author first then the user selects the department, category etc.
Is there any way round this using my approach or will I have to do it all client side?
cheers
Ed