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

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

Explorer ,
Jul 08, 2023 Jul 08, 2023

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.

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

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

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

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

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)
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 ,
Jul 09, 2023 Jul 09, 2023
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? 

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