Solved

Write value from child to main window

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php.ini on ipage hosting 12 59
Problem to Eclipse 16 125
DNS @ Naked Domain Record 5 85
SSL Certificate for IIS7 Site 2 23
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 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