Hi,
I have a form and I am trying to add data to certain text fields based on data that is displayed in a popup window.
this is how i am displaying the popup window
And this is the code in the popup window
As you can see from the red highlighted text I have created a javascript function called "setOther()" and I am calling this from a button however i am lost as to how to get the info displayed in the appropiate field on the main form.
Any help would be appreciated
Regards
Paul
I have a form and I am trying to add data to certain text fields based on data that is displayed in a popup window.
this is how i am displaying the popup window
Code:
<td bgcolor="#CCFFCC"><a href='JavaScript:openPopWin("[URL unfurl="true"]http://SomeNet/Enquiries/ExSampleAddress.asp?<%=[/URL] Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "companynumber=" & rsDetails.Fields.Item("companynumber").Value %>", 600, 350,"scrollbars", 400, 250)' class="TextLeft12px">Search</a></td>
And this is the code in the popup window
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/RNetLive.asp" -->
<%
Dim rsAddresses__cName
rsAddresses__cName = "121332"
If (request.QueryString("companynumber") <> "") Then
rsAddresses__cName = request.QueryString("companynumber")
End If
%>
<%
Dim rsAddresses
Dim rsAddresses_cmd
Dim rsAddresses_numRows
Set rsAddresses_cmd = Server.CreateObject ("ADODB.Command")
rsAddresses_cmd.ActiveConnection = MM_RNetLive_STRING
rsAddresses_cmd.CommandText = "SELECT * FROM tblEQ_Addresses WHERE ? = companynumber"
rsAddresses_cmd.Prepared = true
rsAddresses_cmd.Parameters.Append rsAddresses_cmd.CreateParameter("param1", 200, 1, 255, rsAddresses__cName) ' adVarChar
Set rsAddresses = rsAddresses_cmd.Execute
rsAddresses_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsAddresses_numRows = rsAddresses_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SampleAddress</title>
<link href="../Styles/RigidTextStyles.css" rel="stylesheet" type="text/css" />
[COLOR=red][b]<script language=javascript>
function setOther(){
window.returnValue1 = frmAddress.txtAdd1.value
window.returnValue2 = frmAddress.txtAdd2.value
window.returnValue3 = frmAddress.txtAdd3.value
window.returnValue4 = frmAddress.txtPCode.value
}
</script>[/b][/color]
</head>
<body>
<form id="frmAddress" name="frmAddress" method="post" action="">
<p> </p>
<table width="30%" border="0" align="center" class="tblbodaSolid">
<tr>
<td colspan="6" class="tblHeaderCapsGreen">select address</td>
</tr>
<tr class="tblHeaderCaps11px">
<td>RecId</td>
<td>add 1</td>
<td>add 2</td>
<td>add 3</td>
<td>post code</td>
<td>go</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsAddresses.EOF))
%>
<tr>
<td><label>
<input name="txtID" type="text" class="TextCentrePlain10px" id="txtID" value="<%=(rsAddresses.Fields.Item("ID").Value)%>" size="10" maxlength="10" />
</label></td>
<td><input name="txtAdd1" type="text" class="TextCentrePlain10px" id="txtAdd1" value="<%=(rsAddresses.Fields.Item("Add1").Value)%>" size="20" maxlength="40" /></td>
<td><input name="txtAdd2" type="text" class="TextCentrePlain10px" id="txtAdd2" value="<%=(rsAddresses.Fields.Item("Add2").Value)%>" size="20" maxlength="40" /></td>
<td><input name="txtAdd3" type="text" class="TextCentrePlain10px" id="txtAdd3" value="<%=(rsAddresses.Fields.Item("Add3").Value)%>" size="20" maxlength="40" /></td>
<td><label>
<input name="txtPCode" type="text" class="TextCentrePlain10px" id="txtPCode" value="<%=(rsAddresses.Fields.Item("PostCode").Value)%>" size="10" maxlength="10" />
</label></td>
<td><label>
[COLOR=red][b]<input type=button class="TextCentre12px" onClick="setOther(); window.close()" value="Add Address">[/b][/color]
</label></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAddresses.MoveNext()
Wend
%>
</table>
<p> </p>
</form>
</body>
</html>
<%
rsAddresses.Close()
Set rsAddresses = Nothing
%>
As you can see from the red highlighted text I have created a javascript function called "setOther()" and I am calling this from a button however i am lost as to how to get the info displayed in the appropiate field on the main form.
Any help would be appreciated
Regards
Paul