View Full Version : emote populating a form
Bluemonkey
02-28-2003, 12:59 PM
can anyone point me in the direction of some code to tell me how to populate some fileds from a popup window.
and how can i keep the value of all the fields in a form if the user leaves the page
thank you very much
whammy
03-01-2003, 02:52 AM
That's not a very good explanation of what you're trying to do... you should really read the "Posting Rules" you agreed to when signing up for the forum:
http://www.codingforums.com/postguide.htm
In order for people to be able to help you, it's imperative that you give us the tools to do so.
If you want to populate some fields in the "parent" window, depending upon what was entered in the "child" window, you probably need to use javascript.
This isn't the javascript forum, but almost everyone here uses javascript pretty well, so that really isn't a problem.
Can you give us a URL, or example?
Also, keeping values when someone leaves the page (such as closing their browser) is impossible unless the information has been submitted to the server at least once, and is stored in a session variable, cookie, or whatnot.
Can you give a more detailed explanation of what you're trying to accomplish?
Bluemonkey
03-03-2003, 10:47 AM
thank you very much for the helop i will read the rules over again. yes what you explained with the parent window is what i want at the monet i have a button on my main window to launch a remote window that list all the enterys in a data base and makes a link for them and it uses a small piec of javascript to reurnt the url to the parent window and then the parent window gets the info from the query string. in theory but i just thought the page would needed to be reloaded to populate the form form the info.
and about holding the form info i was going to makea sessions content for each item but i was wondering if there was an easyer way
thanks again
whammy
03-03-2003, 05:07 PM
Ok, that's a start... :)
I assume you know the javascript to open a new window - so what are you going to be doing with the data in this window, and what do you need to pass back? Should be fairly simple.
:)
Bluemonkey
03-03-2003, 05:14 PM
i am going to be showing a list of contacts and sending the deatials of these back to the parent page. i can make a pop up window yes.
this is what i have at the moent but my query string is being cut off after the ? i dont know why cos i have done them befor but this one isnt working
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Contact Details</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0">
<script>
<!--
function remote2(url){
window.opener.location=url
}
//-->
</script>
<%
dim strconn
dim rs
dim sql
strconn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../mdbs/main.mdb")
sql = "SELECT * FROM Tbl_Contact ORDER BY Contact_name ASC"
set rs = server.CreateObject("ADODB.Recordset")
rs.Open sql,strconn,2,2
%>
</p>
<ul>
<%
do while not rs.EOF
'response.Write("<li><a href='javascript:remote2('pmfillout.asp?Contact_Surname="&rs.Fields("Contact_Surname")&"&Contact_Company="&rs.Fields("Contact_Company")&"&Contact_Addressline01="&rs.Fields("Contact_Addressline01")&"&Contact_Addressline02="&rs.Fields("Contact_Addressline02")&"&Contact_Addressline03="&rs.Fields("Contact_Addressline03")&"&Contact_County="&rs.Fields("Contact_County")&"&Contact_Postcode="&rs.Fields("Contact_Postcode")&"&Contact_Country="&rs.Fields("Contact_Country")&"&Contact_Tel="&rs.Fields("Contact_Tel")&"&Contact_telExtention="&rs.Fields("Contact_telExtention")&"&Contact_Fax="&rs.Fields("Contact_Fax")&"&Contact_Mobile="&rs.Fields("Contact_Mobile")&"&Contact_Email="&rs.Fields("Contact_Email")&"')'>"&rs.fields("Contact_Name")&" "&rs.fields("Contact_Surname")&"</a></li><br>") & vbCrlf
response.Write("javascript:remote2('pmfillout.asp?Contact_name="&rs.fields("Contact_name")&"&Contact_Surname="&rs.Fields("Contact_Surname")&"&Contact_Company="&rs.Fields("Contact_Company")&"&Contact_Addressline01="&rs.Fields("Contact_Addressline01")&"&Contact_Addressline02="&rs.Fields("Contact_Addressline02")&"&Contact_Addressline03="&rs.Fields("Contact_Addressline03")&"&Contact_County="&rs.Fields("Contact_County")&"&Contact_Postcode="&rs.Fields("Contact_Postcode")&"&Contact_Country="&rs.Fields("Contact_Country")&"&Contact_Tel="&rs.Fields("Contact_Tel")&"&Contact_telExtention="&rs.Fields("Contact_telExtention")&"&Contact_Fax="&rs.Fields("Contact_Fax")&"&Contact_Mobile="&rs.Fields("Contact_Mobile")&"&Contact_Email="&rs.Fields("Contact_Email")&"')") & vbCrlf
rs.movenext
loop
rs.close
set rs = nothing
%>
<ul>
</body>
</html>
Bluemonkey
03-03-2003, 05:15 PM
sorry the line that is commented out is the line of my link i made the following line to see what it was doing
whammy
03-03-2003, 05:46 PM
Ahh... first of all you don't have a closing quote on your response.write statement.
Also, you probably need to use Server.URLEncode() around your variables (or use escape() client-side) to make sure you don't have any spaces or single quotes, etc. in your URL.
What I would do is view the actual HTML source that's being generated to see what you're getting in this case. :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.