Hi all ... I'm trying to follow Ben's related selects tutorial using cfselect 
and ajax. My cfcs are set up and work correctly (i.e., they return data when 
called manually).

However, when I load up the form, both cfselects appear empty. Can someone take 
a look at what I have and tell me what I'm doing wrong?? Thanks!

Form:

<cfform>
<label for="categoryID" class="requiredLabel">Main Category</label>
<cfselect name="categoryID" 
bind="cfc:path.to.my.cfc.categoryService.getAllCategories()" value="categoryID" 
display="name" bindonload="true" />
<br />
<label for="subCategoryID" class="requiredLabel">Sub-Category</label>
<cfselect name="subCategoryID" value="subCategoryID" display="name" 
bind="cfc:path.to.my.cfc.subCategoryService.getSubByCategoryID({categoryID})" />
<br />
</cfform>

CFCs:

<cffunction name="getAllCategories" access="remote" returntype="query" 
description="Get All Categories" output="false" hint="I get all active 
categories">
                
<cfset var getAllCategories = "" />
                
<cfquery name="getAllCategories" datasource="#application.dsn#">
SELECT categoryID, name FROM categories
WHERE active = 1
</cfquery>
<cfreturn getAllCategories />
</cffunction>

<cffunction name="getSubByCategoryID" access="remote" returntype="query" 
description="Get Sub By CategoryID" output="false" hint="I get all active 
sub-categories for a given categoryID">
<cfargument name="categoryID" required="true" default="0" type="string" 
displayname="category ID" hint="I am the category's database ID" />
                
<cfset var getSubByCategoryID = "" />
                
<cfquery name="getSubByCategoryID" datasource="#application.dsn#">
SELECT subCategoryID, name FROM subCategories
WHERE active = 1
AND categoryID = <cfqueryparam value="#arguments.categoryID#" 
cfsqltype="cf_sql_varchar" />
</cfquery>
                
<cfreturn getSubByCategoryID />
</cffunction> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297210
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to