Solved

CFTREE selected value

Posted on 2010-08-18
6
845 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Join & Write a Comment

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…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now