Solved

Write value from child to main window

Posted on 2001-06-25
3
199 Views
Last Modified: 2013-12-24
I have 2 forms. One is the main.cfm window and the second is the child.cfm window.  I would like to click on a link on the child window and write back to the main window (in the textbox called strTest).

main.cfm
<SCRIPT LANGUAGE = "JavaScript">
window.open('child.cfm','child','width=200,height=220')
</SCRIPT>
<form name="FormName">
<input type="text" name="strTest" value="">
</form>

child.cfm
<SCRIPT LANGUAGE = "JavaScript">
 function FormOpener(textfield)
{
  window.opener.document.FormName.strTest.value = fromthelink; (i don't know how to point to the link)help
  window.close();
}
</script>

<cfQuery name="GetName" datasource="#application.link#" dbtype="ODBC">
Select Name
From Employee
Group by Name
</cfquery>

<cfoutput query="GetName">
<A HREF = "javascript:FormOpener(#trim(Form_Name)#)">#trim(Form_Name)#</A><br>
</cfoutput>

0
Comment
Question by:tb20
  • 2
3 Comments
 

Author Comment

by:tb20
Comment Utility
I figured out the answer.
0
 
LVL 4

Accepted Solution

by:
CF_Spike earned 50 total points
Comment Utility
I think this is what you want:


main.cfm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
     <title>Parent</title>
</head>

<body>

<SCRIPT LANGUAGE = "JavaScript">
window.open('child.cfm','child','width=200,height=220')
</SCRIPT>
<form name="FormName">
<input type="text" name="strTest" value="">
</form>




</body>
</html>

child.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
     <title>Child</title>
</head>

<body>

<SCRIPT LANGUAGE = "JavaScript">
function FormOpener(textfield)
{
 window.opener.document.FormName.strTest.value = textfield;
 window.close();
}
</script>

<CFSET GetName = QueryNew('Name')>
<CFSET NULL = QueryAddRow(GetName)>
<CFSET NULL = QuerySetCell(GetName,'Name','Spike')>
<CFSET NULL = QueryAddRow(GetName)>
<CFSET NULL = QuerySetCell(GetName,'Name','Bob')>
<CFSET NULL = QueryAddRow(GetName)>
<CFSET NULL = QuerySetCell(GetName,'Name','Fred')>
<CFSET NULL = QueryAddRow(GetName)>
<CFSET NULL = QuerySetCell(GetName,'Name','Jim')>
<CFSET NULL = QueryAddRow(GetName)>
<CFSET NULL = QuerySetCell(GetName,'Name','Bill')>

<cfoutput query="GetName">
<A HREF = "##" ONCLICK="Javascript: FormOpener('#trim(Name)#');">#trim(Name)#</A><br>
</cfoutput>


</body>
</html>

Spike
0
 

Author Comment

by:tb20
Comment Utility
Thanks but i was able to get it to work.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
website file permissions 4 54
Problem to get function 52 82
Question to locate the problem 18 52
Ways to assess https/ssl websites 3 53
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now