2017-06-19 45 views
1

点defided存在componentValitation.cfc一个方法,该方法是元素componentValidation在可变

**<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 即时得到像Elementcomponent误差在变量未定义在componentValidation.cfc这已经定义在init()函数中。

我试图调用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) /> 
+0

如有疑问,请查看您的数据。如果您有一个名为'componentValidation.cfc'的变量,请将其转储并查看其中的内容。 –

+0

@Dan Bracuk有variablevalidationtypes添加它给出正确的验证类型 –

回答

0

这可能是一个错误:

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

它不应该是:

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