2010-01-05 62 views
1

我有一个窗体域,填写表格时,我得到错误元素是未定义的类型类coldfusion.filter.FormScope

"Element is undefined in a Java object of type class coldfusion.filter.FormScope". 

有人指着下面的代码的Java对象: -

if(arguments.action eq 'addProficency') 
      { 
// 
// 

      CertificationArray = ArrayNew(1); 

       //add the Certificationes 
       for(i = 0; i lte Event["Certificationes"]; i = i + 1) 
       { 
        CertificationView = CreateObject("Component","com.idl.app.cmn.cfobj.Certification.CertificationView"); 

        CertificationView.SetLine1(Event["Certificationline1_" & i]); 

    CertificationView.SetLine2(Event["Certificationline2_" & i]); 
        CertificationView.SetCity(Event["Certificationcity_" & i]); 
        CertificationView.SetState(Event["Certificationstate_" & i]); 
        CertificationView.SetZip(Event["Certificationzip_" & i]); 

        isRequired = false; 

        if(form.Required eq i) 
        { 
         isRequired = true; 
        } 

        ArrayAppend(CertificationArray,CertificationView); 
       } 
} 

当我注释掉 “

CreateObject("Component","com.idl.app.cmn.cfobj.Certification.CertificationView"); 

         CertificationView.SetLine1(Event["Certificationline1_" & i]); 

     CertificationView.SetLine2(Event["Certificationline2_" & i]); 

” 我没有得到的error.Error是什么意思?如何纠正? 感谢 输精管

+0

@Vas - 索引是否应该从0开始?你如何表明零事件[“证书”]? – Leigh 2010-01-05 20:13:12

+0

@Vas - 结果是什么问题? – Leigh 2010-01-08 17:54:44

回答

3

我同意dhorn。做一个cfdump来查看定义了哪些字段。 更新:我注意到你的for循环从零(0)开始,而不是一(1)。通常情况下,动态表单字段计数器从一(1)开始。那么0 真的是你的情况下正确的起始值?如果是这样,你如何代表零事件认证?

是什么错误意味着

它只是意味着你会引用不存在的表单字段,或者您正在使用的字段名称是无效的。使用数组表示法时,错误消息与使用标准点表示法有所不同。

<!--- result 1 ---> 
<cfset foo = form.FakeFieldNameThatDoesNotReallyExist /> 
Element FAKEFIELDNAMETHATDOESNOTREALLYEXIST is undefined in FORM. 

<!--- result 2 ---> 
<cfset foo = form["FakeFieldNameThatDoesNotReallyExist"] /> 
Element FakeFieldNameThatDoesNotReallyExist is undefined in a Java object of type class coldfusion.filter.FormScope. 
+0

为什么倒票? – Leigh 2010-01-08 17:49:26

+0

它说“投票太旧,不能更改,除非答案是编辑。”请制作一些化妆品版本,它可以再次投票。 – vas 2010-01-09 18:26:22

+0

@vas - 完成。谢谢。 – Leigh 2010-01-10 02:28:53

2

确保事件被实际的定义[ “Certificationline1_” & i]和事件[我 “Certificationline2_” &。尝试一下cfdump,看看它们是否出现在那里。

编辑:错过了单词cfdump。

2

在使用它之前确保存在元素是一种很好的做法。

if (structKeyExists(Event, "Certificationline1_" & i)) { 
    CertificationView.SetLine1(Event["Certificationline1_" & i]); 
}