| CFML Reference |           | 
| ColdFusion Tags
 | 
 
   cfargument
 
Description 
   Creates a parameter definition within a component definition. Defines a function argument. Used within a cffunction tag. 
 
Category 
   Extensibility tags
 
Syntax 
<cfargument 
  name="..." 
  type="..." 
  required="..." 
  default="..." 
  ...> 
 
See also 
   cfcomponent, cffunction, cfinvoke, cfinvokeargument, cfobject, cfproperty, cfreturn
 
Attributes 
   
  
  
    | Attribute | Req/Opt | Default | Description | 
  
    | name 
 | Required 
 | 
 | String; an argument name. 
 | 
  
    | type 
 | Optional 
 | any 
 | String; a type name; data type of the argument. 
 
If the value is not a recognized type, ColdFusion processes it as a component name.any
arraybinarybooleandateguidnumericquerystringstructuuidvariableNamea component name 
 | 
  
    | required 
 | Optional 
 | no 
 | Whether the parameter is required in order to execute the component method. 
 | 
  
    | default 
 | Optional 
 | 
 | A type; if no argument is passed, specifies a default argument value. If this attribute is present, the
 requiredattribute must be set to"no"or not specified.
 | 
 
Usage 
   This tag must be positioned before any other tags within the cffunction tag.
   Arguments that are passed when a method is invoked can be accessed from the method body in the following ways:
- With shorthand syntax: #myargument#
 
(This example accesses the argumentmyargument.)
- Using the arguments scope as an array: #arguments[1]#
 
(This example accesses the first defined argument in the cffunction)
- Using the arguments scope as a struct: #arguments.myargument#
 
(This example accesses the argumentmyargumentin the array)
Comments