Please help!!! This expression must have a constant value
I try to work with cfc and cfinvoke and not sure why I got this error. Searched
in google for answer but still don't get any. Can anyone help please...not sure where
I had it wrong...I thought my codes should work (?)
When a form is submitted I have this codes in formaction.cfm, I captured all the form fields in a structure:
<CFSET st_Registration = {Salutation="#Trim(Form.Salutation)#", FName = "#Trim(Form.FName)#", MName = "#Trim(Form.Mname)#",LName = "#Trim(Form.LName)#" .......etc }/>
Then I set all the required fields:
<CFSET ReqFields ="Salutation,FName,LName,Addr1,City,State,Zip,Country,Phone,Email,username,password">
<!--- Then send the structure and req. fiels list to a function located in a component to verify required fields --->
<cfset CreateUserInfo = createObject("component", "airbucks.cfcomp.VerifyInput").init()>
<CFINVOKE component="#CreateUserInfo#" method="Verify_ReqFields" st_Registration = "#st_Registration#" RequiredFields ="#ReqFields#" returnvariable="VerifyResult">
<CFIF #VerifyResult# IS "">
<cfdump var="#st_Registration#">
<CFELSE>
<CFIF #st_Registration["Country"]# IS "USA">
<CFINCLUDE template="registration_ret.cfm">
<CFELSE>
<CFINCLUDE template="registration_other_ret.cfm">
</CFIF>
</CFIF>
<!--- Below is part of the component with the function for checking required fields --->
<cfcomponent displayname="VerifyInputData" output="false">
<CFFUNCTION name="Init" access="public" returntype="any" output="false" hint="Returns an initialized component instance.">
<!--- Return This reference. --->
<cfreturn THIS />
</CFFUNCTION>
<!--- Verify required fields --->
<CFFUNCTION name="Verify_ReqFields">
<cfargument name="st_Registration" type="struct" required="true">
<cfargument name="RequiredFields" type="string" required="true">
<!--- check if req. fields are blank --->
<CFSET ErrorList = "">
<cfloop collection="#arguments.st_Registration#" item="KEY">
<CFIF #Trim(st_Registration[KEY])# IS "">
<CFSWITCH expression="#Trim(KEY)#">
<CFCASE value="#arguments.RequiredFields#">
<CFSET ErrorList = ListAppend(ErrorList, "#KEY#")>
</CFCASE>
</CFSWITCH>
</CFIF>
</cfloop>
<CFRETURN ErrorList >
</CFFUNCTION>
</cfcomponent>
Here is the error:
| The following information is meant for the website developer for debugging purposes. | ||||||||
| Error Occurred While Processing Request | ||||||||
| ||||||||
