Spec-Zone.ru › ColdFusion

cfargument

Creates a parameter definition within a component definition. Defines a function argument. Used within a cffunction tag.

<cfargument name="">

myFunction(required any myArgument){}

  • CF6+
  • Lucee
  • See Also: cffunction

    Attribute Reference

    name string
    Required

    An argument name.

    type string

    a type name; data type of the argument.
    Values:
    • any
    • array
    • binary
    • boolean
    • component
    • date
    • email
    • function
    • float
    • guid
    • integer
    • numeric
    • query
    • string
    • struct
    • uuid
    • xml
    • variablename
    • (component name)

    required boolean
    Default: no

    Whether the parameter is required to execute the component method.
    Values:
    • true
    • false

    default string

    If no argument is passed, specifies a default argument value.

    displayname string

    Meaningful only for CFC method parameters. A value to be displayed when using introspection to show information about the CFC.

    hint string

    Meaningful only for CFC method parameters. Text to be displayed when using introspection to show information about the CFC. The hint attribute value follows the displayname attribute value in the parameter description line. This attribute can be useful for describing the purpose of the parameter.

    Examples
    Sample code using the cfargument tag

    Script Syntax

    For Script syntax the argument is inside the ()

    public boolean function myFunction(required any myArgument) {
        // Some function bits
        return true;
    }

    Tag Syntax

    For Tag syntax the argument is its own tag

    <cffunction access="public" returntype="boolean" name="myFunction">
        <cfargument required="true" type="any" name="myArgument">
        <!--- Some function bits --->
        <cfreturn true>
    </cffunction>

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/cfargument

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API