Solved

Write value from child to main window

Posted on 2001-06-25
3
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:tb20
ID: 6224858
I figured out the answer.
0
 
LVL 4

Accepted Solution

by:
CF_Spike earned 50 total points
ID: 6224910
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
ID: 6224945
Thanks but i was able to get it to work.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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