Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have a form field and when filling the form , i am getting the error

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

It was pointing to the following code:-

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);
                }
}

When I comment out "

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

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

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

" I am not getting the error.What does the Error mean?How to correct it? Thanks Vas

like image 656
vas Avatar asked Dec 29 '22 06:12

vas


1 Answers

I agree with dhorn. Do a cfdump to see what fields are defined. Update: I noticed your for loop starts at zero (0), not one (1). Typically, dynamic form field counters start at one (1). So is 0 really the correct starting value in your case? If so, how are you representing zero event certifications?

What does the Error mean

It just means you are referencing a form field that does not exist, or the field name you are using is invalid. When you use array notation, the error message is a little different than if you were using the standard dot notation.

<!--- 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. 
like image 95
Leigh Avatar answered Jan 13 '23 13:01

Leigh