This method is invoked in a CFC when a method call exists that is not defined by cffunction or with a function statement.

function onMissingMethod(string missingMethodName, struct missingMethodArguments) { } → returns void

Argument Reference for the onMissingMethod function


Required: Yes
The name of the missing method.


Required: Yes
The arguments that were passed on the function call to the missing method.

Examples sample code invoking the onMissingMethod function

onMissingMethod Example

Creates helper function getPropertyNameForHTML() which calls getPropertyName() and wraps it with the encodeForHTML function.

public function onMissingMethod(missingMethodName, missingMethodArguments) {
    if (reFindNoCase("^get[a-zA-Z0-9]+ForHTML$", arguments.missingMethodName) {
        local.getter = this[replaceNoCase(arguments.missingMethodName, "ForHTML", "")];
        return encodeForHTML(local.getter());
    } else {
        throw (message="Method #encodeForHTML(arguments.missingMethodName)# was not found in the component #encodeForHTML(GetMetaData(this).name)#");

Fork me on GitHub