Solved

CFTREE selected value

Posted on 2010-08-18
6
850 Views
Last Modified: 2013-12-24
Hello,
I need to pass value of the selected item of the tree on popup window to the textbox on the parent page. I tried to use spec.selectedNode.getProperty('data').value and nothing happens. Is there any other way i can get the value of the selected node?  Any help is appreciated.

1)   PARENT WINDOW PARENT.CFM
<SCRIPT LANGUAGE="Javascript">
function OpenTree(href)
{
      remote = window.open(href,'popUp','width=400,height=480,resizable=1,scrollbars=1');
}
</script>
 <cfinput name="spec1" type="text" value="" size="31" id="spec1">
 <a href="tree.cfm  onClick="OpenTree(this.href);return false"> <img src="../images/info.gif" width="20" height="20" border="0" ></a>
                 
2)   THIS IS POPUP WINDOW TREE.CFM
<cfquery name="selspec" datasource="#request.datasource#">
SELECT   specid,SPEC_ID,SPEC_DESC,parent_spec_id, me
from spec where spec_id IS NOT NULL

</cfquery>

<cfform name="specsel">
<cftree  format="html" name="spec">
    <cfoutput query="selspec">
      
      <cfif #spec_id# eq #parent_spec_id#>
      <cfset specparent="#me#">
       <cftreeitem  display="#specparent#" value="#specparent#"  img="FOLDER01.gif"  imgopen="FOLDER02.gif" expand="false">
       <cfelse>
              <cfset specchild=#SPEC_ID# & ' - ' & "#SPEC_DESC#">
              <cftreeitem display="#specchild#" value="#specchild#"  parent="#specparent#">
       </cfif>            
       </cfoutput>            
</cftree>
</cfform>
0
Comment
Question by:kqureshi321
  • 3
  • 3
6 Comments
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 33475326
You can do href

    <cftreeitem value="#specparent#"   href="javascript:OpenTree( 'http://yourlinke.cfm?value=' + #specparent#" #); "  ...

0
 

Author Comment

by:kqureshi321
ID: 33505411
thanks.
What if specchild is selected?
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 33510178
When an item is selected (Clicked), you can bind with click event

See the code example


<cfform name="f1" format="html">
	<cftree  name="tree1" format="html" >
		<cftreeitem value="1" parent="0" display="Root Node"/>
		<cftreeitem value="2" parent="1" display="Branch 1"/>
		<cftreeitem value="3" parent="1" display="Branch 2"/>
		<cftreeitem value="21" parent="2" display="Branch 1.1"/>
		<cftreeitem value="22" parent="2" display="Branch 1.2"/>
		<cftreeitem value="31" parent="3" display="Branch 2.1"/>
		<cftreeitem value="32" parent="3" display="Branch 2.2"/>
		<cftreeitem value="33" parent="3" display="Branch 2.3"/>
	</cftree>
	<cfinput type="text" name="dbgText" bind="{tree1.node@click}"/>
</cfform>

Open in new window

0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:kqureshi321
ID: 33515337
That i understand, but in my case i need to pass selected value to the parent page and i don't want to use url.

0
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 250 total points
ID: 33523544
If you want to pass selected value to the parent page, then I think you have to use some javascript.

Look at

http://www.rgagnon.com/jsdetails/js-0066.html
0
 

Author Closing Comment

by:kqureshi321
ID: 33748044
May be we are not going to use cftree.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

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