So, the most basic form of change you need to make is this:
mystruct.name = form["report[name]"];
What you need to do is write a loop that iterates over the structure of the form and analyzes the names of the form fields and builds such structures. I assume that it is already written somewhere in CFWheels (as a function), and you can save yourself the headache and frustration by simply finding it and pulling it out for yourself.
I think that's all, but I'm not sure:
<cffunction name="$mapStruct" returntype="void" access="public" output="false" mixin="dispatch"> <cfargument name="map" type="struct" required="true" /> <cfargument name="struct" type="struct" required="true" /> <cfargument name="path" type="string" required="false" default="" /> <cfscript> var loc = {}; for(loc.item in arguments.struct) { if (IsStruct(arguments.struct[loc.item])) // go further down the rabit hole { $mapStruct(map=arguments.map, struct=arguments.struct[loc.item], path="#arguments.path#[#loc.item#]"); } else // map our position and value { arguments.map["#arguments.path#[#loc.item#]"] = {}; arguments.map["#arguments.path#[#loc.item#]"].value = arguments.struct[loc.item]; } } </cfscript> </cffunction>
source share