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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing several variables to an iFrame

Status
Not open for further replies.

jon24422531

Technical User
Jan 27, 2004
295
0
0
GB
Hi guys

I have a form on my page Invoices.asp which has several textboxes and select boxes etc. which the user fills out and then presses a button to go to another page. The SQL runs (it's a Stored proc) and all was well.
However if I try to run the same but use an iFrame so that the user can still see the form with their selections, the page loads in the iFrame but without any variables...

There is another button that does not contain any variables and that works OK (InvoicesBOTTOM_LastRun.asp)

This is cutdown version of my code:
Code:
Set rsData = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT DISTINCT BillingGroup FROM CUSTOMER ORDER BY BillingGroup"
RSData.Open strSQL, MyConn			
%>
<form name="InvoiceSearch" method="post">
<table style="text-align: left; width: 80%;" border="0" cellpadding="0" cellspacing="1" bgcolor="#99CCFF">
	<tbody>
    <tr>
      <td ALIGN="right"><small>CustID:</small></td>
      <td>      <input name="CustID"  title="Enter a CustID" style= "width: 100px">
      </td>
      <td ALIGN="right">
	  <small>Date:</small></td>
      <td>
      <select name="Month" style= "width: 80px">
      <option value = "%%">ALL</option>
	  <option value = "1">January</option>
      <option value = "2">February</option>
      <option value = "3">March</option>
      <option value = "4">April</option>
      <option value = "5">May</option>
      <option value = "6">June</option>
      <option value = "7">July</option>
      <option value = "8">August</option>
      <option value = "9">September</option>
      <option value = "10">October</option>
      <option value = "11">November</option>
      <option value = "12">December</option>
      </select>
	  &nbsp;
	  <select name="Year" style="width: 60px">
	  <option value = "<%Response.Write DatePart("yyyy", Date()) %>"><%Response.Write DatePart("yyyy", Date()) %></option>
	  <option value = "2009">2009</option>
	  <option value = "2008">2008</option>
	  <option value = "2007">2007</option>
	  <option value = "2006">2006</option>
	  <option value = "2005">2005</option>
	  <option value = "2004">2004</option>
	  <option value = "2003">2003</option>
	  <option value = "2002">2002</option>
	  <option value = "2001">2001</option>
	  <option value = "2000">2000</option>
	  <option value = "1999">1999</option>
	  </select>
      </td>
	  <td ALIGN="Right"><small>Account No:</small> </td>
	  <td><input name="AccNo" style="width: 100px"></input></td>
    </tr>
    <tr>
      <td ALIGN="right"><small>Invoice Number:</small></td>
      <td> <input name="InvNo"  style= "width: 100px">     </td>
      <td ALIGN="right"><small>Company Name:</small></td>
      <td>
      <input name="CompName"  title="Does not require %, these are put in already" style="width: 150px">
      </select>
      </td>
	  <td ALIGN="Right"><small>Job No:</small> </td>
	  <td><input name="JobNo" title="Exact JobNumber, NO Wildcards!"style="width: 100px"></input></td>
      </tr>
      <tr>
	  <td ALIGN="Right"><small>Billing Group:</small> </td>
      <td><select name="BillGroup" STYLE="width: 100px">
      <option selected="selected" value="%" span style="color:white">%%</option>
	<%while NOT RSData.EOF%><option value="<%=RSData("BillingGroup")%>"><%=RSData("BillingGroup")%></option>
	<%RSData.MoveNext
	wend
	RSData.Close%>
      </select>
      </td>
  	  <td ALIGN="Right"><small>End of Month<input type="radio" name="BillDay" value="3_" /></small></td></td>
	  <td><small>Mid Month<input type="radio" name="BillDay" value="1_" /></small> <input type="radio" name="BillDay" Value="%" checked="checked" style="display:none;" />
	   <input type="button" value="Last Run" onclick="myframe.location.href='InvoicesBOTTOM_LastRun.asp'">
	  </td>
	 <td ALIGN="Right"><button onclick='refresh();'>Reset</button></td>
	 <td>
	 <input type="button" value="Search" onclick="myframe.location.href='InvoicesBOTTOM.asp'">
	 </td>
    </tr>
  </tbody>
  </table>
<br>
<%
set MyConn = Nothing
%>
</div id>
<iframe src="InvoiceStart.asp" name="myframe" width=100%, height=90% scrollbars=true></iframe>
</form>
</body>
</html>

And the code on the InvoicesBOTTOM.asp is

Code:
Set rsData = Server.CreateObject("ADODB.Recordset")
strSQL = "EXEC RSp_InvoiceSearch " & _ 
		"@CustID ='" & Request.Form("CustID") & "'," & _ 
		"@CompanyName ='" & Request.Form("CompName") & "'," & _ 
		"@AccountNo ='" & Request.Form("AccNo") & "'," & _ 
		"@BillingGroup ='" & Request.Form("BillGroup") & "'," & _ 
		"@BillingDay ='" & Request.Form("BillDay") & "'," & _ 
		"@Month ='" & Request.Form("Month") & "'," & _ 
		"@Year ='" & Request.Form("Year") & "'," & _ 
		"@InvoiceNumber ='" & Request.Form("InvNo") & "'," & _ 
		"@JobNr ='" & Request.Form("JobNo") & "'," & _ 
		"@AccountManager ='%'"
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "Driver={SQL Server};Server=FTLive;Database=squirrel;Uid=app;Pwd=;" 
rsData.Open strSQL, MyConn
if rsData.eof then
%>
<FONT SIZE="+1" COLOR="RED">There are no Invoices of that number or criteria.</FONT>
<%
else
Dim strCount
strCount=0
While NOT rsData.EOF AND NOT rsData.BOF
strCount=strCount + 1
rsData.MoveNext()
Wend
rsData.MoveFirst
%>
<P><b><big title="No.Invoices">Number of Invoices: <%Response.Write(strCount)%></big> &nbsp; &nbsp;Click on <span style="color:blue">Invoice No.</span> to open, click header to sort. (SOON)</b>
<form name="SelectVar" method="post" action="InvoiceSelect.asp">
</form>
<table border='0'>
<tr>
<%
	for each fieldItem in rsData.fields
		Response.Write vbTab & vbTab &"<td bgcolor=""#99CCFF""><strong>" & fieldItem.name
		Response.Write "</strong></td>" & vbCrLf
	next
		Response.Write vbTab & "</tr>" & vbCrLf
%>
</tr>
<%
Do While not rsData.EOF
	Response.Write "<tr>"
	for each fieldItem in rsData.fields
	Response.Write "<td>&nbsp;" & fieldItem.value & "</td>"
	next
	Response.Write "</tr>"
	rsData.MoveNext
Loop
%>
</table>
<%
End IF
rsData.Close
set rsData = Nothing
set MyConn = Nothing
%>
</div id>

So the question is how can I pass the variables to an iFrame on the same page?

Thanks

Jonathan
 
You're not submitting the form. Your code is designed to set the document in the frame to the page, not to submit the form to it.

myframe.location.href='InvoicesBOTTOM.asp' does exactly that. It sets the location to that page in the same way as if you'd typed it into a browser. It has no concept of the form you want to submit.

You need to either submit your form to the iframe:
<form name="InvoiceSearch" method="post" action="InvoicesBOTTOM.asp" target="myframe">

or, if you insist on doing it with a javascript call, you'll need to build it as a querystring:
myframe.location.href='InvoicesBOTTOM.asp?CustID='+document.InvoiceSearch.value+'&Month='...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top