Hi All,
I'm not really a newbee anymore but this simple code doesn't be
working for some reason. I'm getting the following when I run the
create function. It's the conditional <cfif project.create()> that
giving the problem. I'm validating on the model, <cfset
validatesPresenceOf("projectTitle")>.
Cannot convert the value of type class
coldfusion.runtime.TemplateProxy to a boolean
The error occurred in /Applications/ColdFusion9/wwwroot/slotc-
nonprofits/controllers/Projects.cfc: line 46
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
global/cfml.cfm: line 174
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
controller/processing.cfm: line 85
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
controller/processing.cfm: line 60
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
dispatch/request.cfm: line 285
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
index.cfm: line 1
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/
index.cfm: line 1
Called from /Applications/ColdFusion9/wwwroot/slotc-nonprofits/wheels/
events/onrequest.cfm: line 1
44 : <cfset project = model("project").create(modParams)>
45 :
46 : <cfif project.create()>
47 : <cfset redirectTo(action="index")>
48 : <cfelse>
Here's the cfwheels code:
<cffunction name="create">
<cfset modParams = structNew()><!---params contains a key named
"id". This is needed for the cfselect tag to produce the dependent
select box effect. I want to rename this key to categoryId so as not
to confuse CFWheels.--->
<cfset modParams.categoryTypeId = #params.categoryTypeID#>
<cfset modParams.categoryId = #
params.id#>
<cfset modParams.projectTitle = #params.projectTitle#>
<cfset modParams.description = #params.description#>
<cfset modParams.nonProfitId = #
session.currentUser.id#>
<cfset modParams.telecommute = #params.telecommute#>
<cfset project = model("project").create(modParams)>
<cfif project.create()>
<cfset redirectTo(action="index")>
<cfelse>
<cfset renderPage(action="add")>
</cfif>
</cffunction>