Forgive the humongous title there. Cyril asks:
I am trying to create a simple file in chooser in a cfwindow using cftree using Ben's example of filesystem browser, to populate a form field. I can open the window and the tree works fine, but how do I return the value of the node to the input field? I tried to look up ColdFusion.getElementValue but there is very little information on how to use it even on Livedocs.
So first off, here is the demo on Ben's site that Cyril was talking about: ColdFusion Ajax Tutorial 5: File System Browsing With The Tree Control Ben's demos hows a CFC feeding file information to an Ajax based tree. The issue Cyril is having though is in getting the value from the tree.
This actually is covered in the reference guide for getElementValue, but you may have skimmed over it. The third attribute to getElementValue allows you to specify a particular attribute of the element to retrieve the value. This is necessary for Tree's as they have two main values: PATH and NODE. So Cyril simply needs to do something like so:
<script>
function test() {
var myval = ColdFusion.getElementValue('dirtree','myform','path');
alert(myval);
}
</script>
<cfform id="myform">
<cftree name="dirtree" format="html">
<cftreeitem bind="cfc:dirtree.getDirEntries({cftreeitempath},
{cftreeitemvalue})">
<cfinput type="button" onclick="test()" name="testbutton" value="Test">
</cftree>
</cfform>