Forum Moderators: open
<select name="select">
<%
while (!Recordset1.EOF)
{
%>
<option value="<%=(Recordset1.Fields.Item("URL").Value)%>" ><%=(Recordset1.Fields.Item("URL").Value)%></option>
<%
Recordset1.MoveNext();
}
if (Recordset1.CursorType > 0) {
if (!Recordset1.BOF) Recordset1.MoveFirst();
} else {
Recordset1.Requery();
}
%>
</select>
<input type="submit" name="submit" value="submit">
<DIV id="iframeContainer" style="position:absolute; left:23px; top:10px; width:970px; height:153px; visibility:visible;">
<IFRAME src="<%=(Recordset1.Fields.Item("URL").Value)%>" border=0 frameborder=0 marginheight=0 marginwidth=0 width="100%" height="100%" name="iframeElement" id="iframeElement" scrolling=none>
</IFRAME> </DIV>
I have a database of URLS which connects to a list box. Once the URL is selected from the list box, i want the URL to appear in the IFRAME, this works for the first url, but then after nothing happens, i know its to do with the submit button value, but im not sure what should go in here. thanks
FormSelectVar = select.value;
then
IFRAME src="<%=FormSelectVar%>"
I would also make the select box option selected that is the current value to keep state.
<select name="select">
<%
while (!Recordset1.EOF)
{
%>
<option value="<%=(Recordset1.Fields.Item("URL").Value)%>"
<% if (Recordset1.Fields.Item("URL").Value == FormSelectVar){
%>
SELECTED
<%
}
%>
><%=(Recordset1.Fields.Item("URL").Value)%></option>
<%
Recordset1.MoveNext();
}
if (Recordset1.CursorType > 0) {
if (!Recordset1.BOF) Recordset1.MoveFirst();
} else {
Recordset1.Requery();
}
%>
</select>
I would try something like that. There are plenty of ways to do it. Be kind to your visitor and keep their state.
When you submit this it will pass a query string to "pagename". On "pagename"
Request the query string parameters.
Request.Querystring("select")
this will give you the value of your select name value pair in the query string.
pagename?select=URL
assign the value of your select form field to a variable.
FormSelectVar = Request.Querystring("select")
You will then have that variable containing your url for the life of the page.
Use your variable any where on the page where you want to display the last choice of a form post.
My syntax is probably wrong, but that is what you need to get your task done.