<cfparam name="airInfo.leaving" type="struct" default="#structNew()#">
<cfparam name="flightInfo.depart" type="string" default="departing">
<cfparam name="flightInfo.arrive" type="string" default="arriving">
<cfset flightInfo = airInfo.leaving>
<cfset fromInfo = flightInfo.depart>
<cfset arriveInfo = flightInfo.arrive>
<cfdump var="#flightInfo#">
This should work… I think, but I keep getting an error saying depart is undefined in flightInfo. I know I could use if structKeyExists() but this is just a snippet of a larger application. I can’t be checking all the variables in that mannor, and really need to use cfparam. What am I missing from this?
Perhaps the second and third cfparams should be setting airInfo.depart and airInfo.arrive instead of flighInfo.depart and flightInfo.arrive.
EDIT: I should mention that your flightInfo variable gets overwritten by the empty struct that you create in the first cfparam and that’s why you get the undefined error.
If your intent is to default flightInfo with depart and arrive, you should set those variables in airInfo.leaving as in airInfo.leaving.depart and airInfo.leaving.arrive and then assign airInfo.leaving to flightInfo.