Skip to main content
Inspiring
February 1, 2010
Answered

first component . . .

  • February 1, 2010
  • 3 replies
  • 902 views

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

The RFORMID argument passed to the getDetails function is not of type numeric.

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>

This topic has been closed for replies.
Correct answer Joshua_Cyr

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#">

3 replies

Inspiring
February 2, 2010

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

rockhikerAuthor
Inspiring
February 2, 2010

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 : 

Inspiring
February 2, 2010

The name of your returnvariable is "form" and you are trying to output a query named "aform".

Joshua_CyrCorrect answer
Participating Frequently
February 1, 2010

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#">

Inspiring
February 1, 2010

What is the value of url.rformid?