Ugh.
So I am trying to build a simple form to drill down "local sales rep".
I have a custom type "rep" that uses categories that assign the "rep"
to certain territories.
I want to build a page that allwos the user to select a parent
"territory" and if applicable a "sub territory", click submit and get
the reps listing.
I havea very simply form I am working on and can succesfully pull the
territory and sub.. but as soon as I drop it in my facry project, its
stops working. It seems that the application.cfm breaks it, as If I
put a dummy application.cfm file in the dev folder the drop downs work
again.
Anyo one developed a nice way of doing this they would like to share,
or perhaps can hekp me get this working?
Here's the basic code.. If you put it in a folder not exposed to
farcry's application.cfm and set the objectid to one of your own
categories with children you'll see it works great as far as relating
the selects.
rep.cfc:
<cfcomponent output="false">
<cfset application.dsn = "XXXX">
<cfset application.dbowner = "">
<cffunction name="getCats" access="remote" returnType="array">
<!-- the top of the territories category --->
<cfargument name="ObjectID" default="F50E50A4-5056-
B023-203ADA76955B8C5F">
<cfscript>
oTree =
CreateObject("component","farcry.core.packages.farcry.tree");
data=oTree.getChildren(ObjectID='#arguments.objectid#');
result=ArrayNew(2);
i=0;
</cfscript>
<!--- Convert results to array --->
<cfloop index="i" from="1" to="#data.RecordCount#">
<cfset result[i][1]=data.OBJECTID[i]>
<cfset result[i][2]=data.OBJECTNAME[i]>
</cfloop>
<!--- And return it --->
<cfreturn result>
</cffunction>
<cffunction name="getCatsB" access="remote" returnType="array">
<cfargument name="ObjectID" default="F50E50A4-5056-
B023-203ADA76955B8C5F">
<cfscript>
oTree =
CreateObject("component","farcry.core.packages.farcry.tree");
data=oTree.getChildren(ObjectID='#arguments.objectid#');
result=ArrayNew(2);
i=0;
</cfscript>
<!--- Convert results to array --->
<cfloop index="i" from="1" to="#data.RecordCount#">
<cfset result[i][1]=data.OBJECTID[i]>
<cfset result[i][2]=data.OBJECTNAME[i]>
</cfloop>
<cfif arraylen(result) EQ 0>
<cfset result[1][1]="">
<cfset result[1][2]="N/A">
</cfif>
<!--- And return it --->
<cfreturn result>
</cffunction>
</cfcomponent>
then a simple form.cfm (CF8)
<cfinvoke component="findarep" method="getCats">
<cfform>
<table>
<tr>
<td>Select Region:</td>
<td><cfselect name="region"
bind="cfc:findarep.getCats()"
bindonload="true" tooltip="Select a region" /></td>
</tr>
<tr>
<td>Select Subregion:</td>
<td><cfselect name="artid"
bind="cfc:findarep.getCatsB({region})"
bindonload="false"
/></td>
</tr>
</table>
</cfform>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---