Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

first component . . .

Explorer ,
Feb 01, 2010 Feb 01, 2010

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>

TOPICS
Getting started
798
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Feb 01, 2010 Feb 01, 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#">

Translate
LEGEND ,
Feb 01, 2010 Feb 01, 2010

What is the value of url.rformid?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 01, 2010 Feb 01, 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#">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2010 Feb 01, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2010 Feb 01, 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 : 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2010 Feb 01, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2010 Feb 01, 2010
LATEST

Thank you Dan, A Cameron, and Joshua - you all helped to get it working!!!

Thanks  jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources