I've probably over complicated something or not done something the right way....

I've got a custom type that I've created a form for that goes on the
front of the site. I've added an init() method to the cfc, so that I
can create an empty struct or pass in a struct ( eg. form struct) and
populate it with that data. I've also added a validation method, which
returns a struct of fields from the type struct that don't validate.

This is all working fine.  The problem I have is that when I pass the
struct to setData() I get the error "Variable propertyName is
undefined.  <br>The error occurred on line 357." in
\fourq\gateway\DBGateway.cfc and I'm not entirely sure why.

The struct is created using the metadata from getPropsAsStruct() and
is just a struct with keys that match the properties in the type for
example the custom type is actually a registration form, so I have
fields called "title", "surname","firstname" etc.

I call setData() as follows :

oTeacher = 
CreateObject("component","farcry.#application.applicationname#.packages.types.smTeacher");
newTeacher = oTeacher.init(form);
oTeacher.setData(newTeacher,'website');

There's a bit more to it than that but only some checks to see if a
form has been submitted and some additional data that is needed for
the form.

The init function is just this :
        var thisTeacher = StructNew();
        var stProps = getPropsAsStruct();
        var KeyList = StructKeyList(stProps);
        var KeyListCount = ListLen(KeyList);
        
        for (i=1; i LTE KeyListCount; i=i+1) {
                thisKey = ListGetAt(KeyList,i);
                thisTeacher[thisKey] = stProps[thisKey].MetaData.Default;
                if (StructKeyExists(arguments,"varDefaults") AND
StructKeyExists(arguments.varDefaults,thisKey)) {
                        thisTeacher[thisKey]    = 
arguments.varDefaults[thisKey];
                }
        }

Any thoughts would be appreciated, as I'd kind of like to use this
method, rather than having to write a save method that inserts the
data using a query.

Regards

Stephen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/farcry-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to