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

Please elaborate how many ways are there to call a CFC function from a .cfm page?

New Here ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

Hi,

 

Could you please elaborate  how many ways are there to call a CFC function from a .cfm page?  And I have one more doubt. Can I create a cfc function without creating a cfcomponent? Thank you.

Views

1.5K

Translate

Translate

Report

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
Community Expert ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

There are at least a few: cfobject and cfinvoke (and their cfscript equivalents), as well as the createObject function, and the new keyword.

 

As for your last question, you can certainly create a function in a cfm (without a CFC) using the cffunction tag or script function statement. That could be called from that cfm or any that included that file. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

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
New Here ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

Thank you Charlie for replying. Can i create  functions alone in  a .cfc file without creating the cfcomponent?

Votes

Translate

Translate

Report

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
Community Expert ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

Well, a CFC *IS* a cf component. Your questions are implying you have in mind either some challenge or something clever that you're considering. Can you please elaborate? 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

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
New Here ,
Jul 09, 2023 Jul 09, 2023

Copy link to clipboard

Copied

LATEST

No, I'm was thinking if I can create a cffuntion inside cfc file (without a cfcomponent). And one more doubt please. If I use cfinvoke to call a function in cfc and pass argumentCollection(#Form#) , how should I receive it in the cffunction? Should I create an cfargument for it inside the cffunction? 

Votes

Translate

Translate

Report

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
Documentation