We help IT Professionals succeed at work.

Close Cfwindow and send value to parent

Medium Priority
840 Views
Last Modified: 2012-05-06
Hi there,

I try to close a cfwindow and put value set in a href to a field in parent page.

please see the code below
************ Parent page ************
 
 
<cflayout name="thelayout" type="border">
 
<cflayoutarea name="top" position="top" size="100" splitter="false" style="height:100%;">
 
</cflayoutarea>
 
<cflayoutarea name="left" position="left" closable="false" collapsible="true" splitter="true" style="height:100%; width:180px;">
 
</cflayoutarea>
 
<cflayoutarea name="center" position="center" style="height:100%;" >
 
</cflayoutarea>
 
 
<cflayoutarea name="right" position="right" closable="false" collapsible="true" splitter="true" style="height:100%; width:850px;">
 
<cfajaximport tags="CFFORM,CFINPUT-DATEFIELD,CFDIV,CFWINDOW">
 
 
<cfform>
<cfinput type="text" name="mytext">
</cfform>
 
 
 
</cflayoutarea>
 
</cflayout>
 
 
 
************ The cfwindow ************
 
<a href="Team1">Please click to choose the Team 1</a>
<a href="Team2">Please click to choose the Team 1</a>

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Commented:
try this
<script type="text/javascript">	
function showSelectTeam(){
		
		myWindow = ColdFusion.Window.getWindowObject('selectteam');
		myWindow.hide();
		myWindow.center();
	    myWindow.show();
}
function selectTeam()
{
document.getElementById('teamid').value=selectTeam.arguments[0]
document.getElementById('displayTeam').innerHTML='Selected Team Is: ' + selectTeam.arguments[0]
myWindow = ColdFusion.Window.getWindowObject('selectteam');
		myWindow.hide();
}
 
</script>	
<input type="text" disabled id="teamid" name="teamid">
<div id="displayTeam"></div>
<button onclick="showSelectTeam();">Select Team</button>
<cfwindow initShow="false" center="true"  modal="true" closable="true" 
name="selectteam" width="500" height="100"
			 title="Select Team" bodyStyle="text-align:center;">
			 <button onclick="selectTeam(1);">Team 1</button>
			 <button onclick="selectTeam(2);">Team 2</button>
			</cfwindow> 

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.