dupps1
06-18-2004, 11:51 PM
Hi Guys...
I refined my problem and posting it again as i did not get any replies for my previous post...
My dynamic drop down boxes are working fine but i am unable to post the value selected in the second drop down box to the next page where i can list the details of this selected value....
Any suggestions would be appreciated...
thanks in advance ...
Below is my code for the drop down boxes...
file 1 -- types.asp
************************
<SCRIPT language="JavaScript">
function getIframe()
{
document.form1.item.value=parent.iframe1.document.form2.elements[0].value;
}
</SCRIPT>
<BODY>
<%
Set rsitem = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.Open strConnect
Sql = "SELECT Typename, Typeid FROM foodtype WHERE Activeind=1 ORDER BY Typename ASC"
Set rsitem = MdConnection.Execute(Sql)
'Response.Write SQl
%>
<div align=center>
Item Selected <%="<font color= 'red'>" &request("item")&" </font>"%> <--- this does not work... i dont get any value printed
<FORM NAME="form1" onsubmit="getIframe()">
<table border="0">
<tr>
<td bgcolor='f0f0f0'>Food Type</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'>item</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>
IF i do this i get the alert box with the selected value but i am not sure how to post this value
<td><input type="hidden" name="item"><input type='submit' value='Go' onclick="alert(iframe1.document.form2.elements[0].value);"></td>
<td></td>
</tr>
</table>
</FORM>
</div>
</BODY>
************************
file 2 - items.asp
************************
<body leftmargin=0>
<form name="form2">
<%
Set rs = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.Open strConnect
Sql = "SELECT Itemname, Itemnum FROM cafe WHERE Activeind=1 AND Itemtype="&request("Itemtype")&" ORDER BY Itemname ASC"
Set rs = MdConnection.Execute(Sql)
%>
<%
if not rs.eof then
response.write "<select name='items'>"
while not rs.EOF
response.write "<option value='" & trim(rs(0))& "'>" & trim(rs(0))
rs.MoveNext
wend
response.write "</select>"
rs.close
set rs=nothing
end if
%>
</form>
</body>
************************
I refined my problem and posting it again as i did not get any replies for my previous post...
My dynamic drop down boxes are working fine but i am unable to post the value selected in the second drop down box to the next page where i can list the details of this selected value....
Any suggestions would be appreciated...
thanks in advance ...
Below is my code for the drop down boxes...
file 1 -- types.asp
************************
<SCRIPT language="JavaScript">
function getIframe()
{
document.form1.item.value=parent.iframe1.document.form2.elements[0].value;
}
</SCRIPT>
<BODY>
<%
Set rsitem = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.Open strConnect
Sql = "SELECT Typename, Typeid FROM foodtype WHERE Activeind=1 ORDER BY Typename ASC"
Set rsitem = MdConnection.Execute(Sql)
'Response.Write SQl
%>
<div align=center>
Item Selected <%="<font color= 'red'>" &request("item")&" </font>"%> <--- this does not work... i dont get any value printed
<FORM NAME="form1" onsubmit="getIframe()">
<table border="0">
<tr>
<td bgcolor='f0f0f0'>Food Type</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'>item</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>
IF i do this i get the alert box with the selected value but i am not sure how to post this value
<td><input type="hidden" name="item"><input type='submit' value='Go' onclick="alert(iframe1.document.form2.elements[0].value);"></td>
<td></td>
</tr>
</table>
</FORM>
</div>
</BODY>
************************
file 2 - items.asp
************************
<body leftmargin=0>
<form name="form2">
<%
Set rs = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.Open strConnect
Sql = "SELECT Itemname, Itemnum FROM cafe WHERE Activeind=1 AND Itemtype="&request("Itemtype")&" ORDER BY Itemname ASC"
Set rs = MdConnection.Execute(Sql)
%>
<%
if not rs.eof then
response.write "<select name='items'>"
while not rs.EOF
response.write "<option value='" & trim(rs(0))& "'>" & trim(rs(0))
rs.MoveNext
wend
response.write "</select>"
rs.close
set rs=nothing
end if
%>
</form>
</body>
************************