Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple cascaded drop down lists 1

Status
Not open for further replies.

techzone12

Technical User
Aug 24, 2005
32
0
0
US
I want to have multiple frames within a single ASP/HTML page.

The idea is that one frame will have a drop down menu and a submit button. When the submit button is clicked, the second frame should display. The second frame will have the dynamic content based on the selection that was made in the first. In other words the action is handled in the second frame (rather that a second ASP page).

Is this possible? Or should I just use tables within the same page. The show/hide tables with VB programming.

I would appreciate any hints. Thanks
 
1. You have a single sql query to get all the values you want from different tables using joins.
2. use <div> or <span> tags to show the selected items
3. you should something like this in your form
<FORM NAME="form1" onsubmit="getIframe()"> and once something is selected from the first drop down box you need to make this fram visible and load with the contents based on the selection.

I have code just for this purpose in my repository but need to search for it...but thats the idea...also i would suggest you to post this in Javascript forums...

-DNG
 
Can you do me a favor and post the code you were mentioning, when you get a chance to search for it. Thanks a lot
 
ok i have this piece of code...try if you adapt it to your needs...first try on a simple query to understand whow the whole page works..then you can completely try for your present requirement...just replace queries and other variables...

Code:
<%Response.Buffer = True%>

<HTML>
<HEAD>
<TITLE>Select an item</TITLE>
<SCRIPT language="JavaScript">
function getIframe()
{
document.form1.item.value=iframe1.document.form2.elements[0].value;
}
</SCRIPT>
</HEAD>


<%
Set rsitem = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.Open "your connection string here"

Sql = "SELECT Typename, Typeid FROM foodtype WHERE Activeind=1 ORDER BY Typename ASC"

Set rsitem = MdConnection.Execute(Sql)

'Response.Write SQl
%>


<div align=center>
<b><font face="Arial" color="#800000">Cafeteria Menu<%="<font color= 'red'>" &request("item")&" </font>"%>

<%
If request("item")<>"" Then
Response.Redirect("selecteditem.asp?itemno="&request("item"))
End if
%>- Update/Delete an item</font></b><p align="left"><i><b>
<font face="Arial" color="#FF0000" size="2">Select an item:</font></b></i></p>
<FORM NAME="form1" onsubmit="getIframe()">
    <table border="0">
    <tr>
      <td bgcolor='f0f0f0'><b><font face="Arial" size="2" color="#0000FF">Item 
		Type:</font></b></td>
      <td>
	  <select onchange='document.getElementById("iframe1").src="items.asp?Itemtype="+ this.value'>
	  <option value='' selected>-----Select-----
  	  	<%While Not rsitem.EOF%>
		<option value="<%Response.Write rsitem.Fields("Typeid")%>"><%Response.Write rsitem.Fields("Typename")%></option>
     <%
      	rsitem.MoveNext
	    Wend
      %>

	  </select>
	  </td>
    </tr>
    <tr>
      <td bgcolor='f0f0f0'><b><font face="Arial" size="2" color="#0000FF">Item:</font></b></td>
      <td><iframe  id="iframe1" name='iframe1' FRAMEBORDER=0 SCROLLING='no' WIDTH=500 HEIGHT=40></iframe></td>
    </tr>
	  <tr>
      <td><input type="hidden" name="item"><input type='submit' value='Go'></td>
      <td></td>
    </tr>
  </table>
</FORM>
 </div>
</BODY>
</HTML>

not tested though...but it should definitely give you an idea..post back if you have more questions...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top