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

Using CFComponent with parameters

New Here ,
Dec 31, 2007 Dec 31, 2007
Does anyone know what wrong with my codes?

-- Codes --
<cfset strUsername = "Raymond">

<cfinvoke component="cfc.content" method="funcWelcomeMsg"><cfinvokeargument name="strUsername" value="Raymond"></cfinvoke>

-- Component --
<cfcomponent displayname="content" hint="Component to store content manipulation functions">
<!--- Function to return Welcome messages --->
<cffunction name="funcWelcomeMsg">
<cfparam name="strUsername" type="string">

<cfoutput>
<table width="200" border="0" cellpadding="0" cellspacing="0" class="nav_bar">
<tr>
<td align="right">Welcome, #strUsername#</td>
</tr>
</table>
</cfoutput>
</cffunction>
</cfcomponent>

-- Error --
The required parameter strUsername was not provided.
This page uses the CFPARAM tag to declare the parameter strUsername as required for this template. The parameter is not available.Please verify that you have passed or initialized the parameter correctly. If you wish to set a default value for the parameter you should use the DEFAULT attribute of the CFPARAM tag.
699
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 , Dec 31, 2007 Dec 31, 2007
Don't use cfparam in your cffunction. Use cfargument.

Translate
Engaged ,
Dec 31, 2007 Dec 31, 2007
Don't use cfparam in your cffunction. Use cfargument.

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
New Here ,
Dec 31, 2007 Dec 31, 2007
LATEST
thx for ur advice, long time din codes CFML already 🙂
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