Copy link to clipboard
Copied
Hi, I am trying take my stuff to the next level and currently trying to get this cfc to work. The component has two functions straight out of the Getting Started in cf8 book.
The fist function works just fine. It queries the database and returns a list forms.
The list page passes the variable to the details page like so: <a href="cfcDrivenDetails.cfm?rformID=#rformID#">
The second function in the component does not work. I keep getting the error below. The rformID field is numeric (autonumber - Access database)
I invoke the second function from the details page with the following code
<cfinvoke
component="CFC/reqForms"
method="getDetails"
returnvariable="form"
rformID="URL.rformid">
It says the errror is in the cfc at the line in bold below - any help is hugely appreciated and really needed!
thanks - jim
If the component name is specified as a type of this argument, its possible that a definition file for the component cannot be found or is not accessible.
the component:
cfcomponent>
<cffunction name="list" access="public"
returnType="query" output="false">
<!---define local variable--->
<cfset var forms=" ">
<!---Get forms list from database--->
<cfquery name="forms" datasource="formMagic">
SELECT rformID, wac, formName, description, formDoc, dueDate, forYear, docURL, submittal
FROM dueDateCalendar
</cfquery>
<cfreturn forms>
</cffunction>
<cffunction name="getDetails" access="public"
returnType="query" output="false">
<cfargument name="rformID" type="numeric" required="true">
<cfset var forms=" ">
<cfquery name="form" datasource="formMagic">
SELECT rformID, wac, formName, description, formDoc, dueDate, forYear, docURL, submittal
FROM dueDateCalendar
where rformID=#ARGUMENTS.rformID#
</cfquery>
<cfreturn form>
</cffunction>
</cfcomponent>
pretty sure you are passing the text 'url.rformid' not the value of it.
Try
<cfinvoke
component="CFC/reqForms"
method="getDetails"
returnvariable="form"
rformID="#URL.rformid#">
Copy link to clipboard
Copied
What is the value of url.rformid?
Copy link to clipboard
Copied
pretty sure you are passing the text 'url.rformid' not the value of it.
Try
<cfinvoke
component="CFC/reqForms"
method="getDetails"
returnvariable="form"
rformID="#URL.rformid#">
Copy link to clipboard
Copied
Over and above what the others say, note that you're defining a local var FORMS in your second method, but then go on to use FORM in your query and your return statement. FORM of course is a scope, and you probably dun't wanna be using it as a variable name. I expect this is a typo though.
Also... use <cfqueryparam>!!
--
Adam
Copy link to clipboard
Copied
I tried the following code of got the following error.
<cfinvoke
component="CFC/reqForms"
method="getDetails"
returnvariable="form"
rformID="#URL.rformid#">
I did change the variable and query to aform.
The error below is now coming from the action page.
Attribute validation error for tag cfoutput. | |
The value of the attribute query, which is currently aform, is invalid. | |
The error occurred in C:\Webroot\Crabweb1a\Administration\requiredFormsAdmin\cfcDrivenDetails.cfm: line 49 | |
47 : 48 : 49 : <cfoutput query="aform"> 50 : 51 : |
Copy link to clipboard
Copied
The name of your returnvariable is "form" and you are trying to output a query named "aform".
Copy link to clipboard
Copied
Thank you Dan, A Cameron, and Joshua - you all helped to get it working!!!
Thanks jim