元素componentValidation没有在变量中定义

时间:2017-06-19 12:30:04

标签: coldfusion coldfusion-8 coldfusion-11

我的某个组件componentValitation.cfc中有一个方法:

<cffunction name="getValidationTypeRegExpByID" access="public" 
      returntype="string" output="false">

    <cfargument name="componentValidationTypeID" type="numeric" required="true">
    <cfscript>
        if (structKeyExists(variables.componentValidationTypes, arguments.componentValidationTypeID))
        {
            return variables.componentValidationTypes[arguments.componentValidationTypeID].RegExp;
        }
        return '';
    </cfscript>
</cffunction>

我想从另一个组件调用上面提到的方法。我尝试从common.cfc这样调用它

var advertisement = getComponentValidation('component','sys.jo.core.fe.componentValidation');
<cfset testttt = advertisement.getValidationTypeRegExpByID(componentValidationTypeID) />
<cfset errorMessage = "#componentShortLabel# #Lib.showCaption('message_Decimal2dpValidation', UserIdentity)#" />
<cfset arguments.Message.addValidationError( keyName=QuestionID,  errorMessage=errorMessage, componentKey=ComponentID, componentErrorMessage=errorMessage, tupleIndex=arguments.tupleIndex, QuestionDisplayNumber=errorDisplaySequenceNumber ) />

但是我在componentValidation.cfc(已经在我的init()函数中定义)的变量中没有定义像Elementcomponent这样的错误。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

这可能是一个错误:

var advertisement = getComponentValidation('component','sys.jo.core.fe.componentValidation');

不应该是:

var advertisement = createobject('component','sys.jo.core.fe.componentValidation');