Solved

Write value from child to main window

Posted on 2001-06-25
3
260 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

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

717 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