a very annoying error, i am passing a structfrom c...
# cfml-general
g
a very annoying error, i am passing a structfrom calling page using createobject instead of new and calling the init method and pasing the struct to it and in the cfc i did this <cffunction name="init" output="false">
Copy code
<cfargument name="structform" type="any" required="true">
           <!--- initialize variables used within this component --->        
        <cfscript>            
            dsn = arguments.structform.dsnName;            
            uname = structform.uname;            
            pass  = structform.pass;
        </cfscript>
              <!--- return a reference to this component --->        
   <cfreturn this>
and it is saying structform is undefined in arguments i tried passing values one by one, still same issues, it only works when i just pass one value and that is the dsn name but i need otehr values, this is really making me annoying
m
show us your calling code please.
g
Copy code
db = {
'dsn':'dbbname',
'uname': 'testuser123',
'upass':'test123'
}>
x = createobject("component","pages").init(db)>
m
you have }> at the end of your Struct assignment; shouldn't that be }; ?
j
try keeping them all scoped as "arguments.structform.______" you do not define structform outside of the argument scope.
m
It looks like you call it dsnname in your function and dsn in your struct
and also upass vs pass as well...
Copy code
<cfscript>
db = {
'dsnName':'dbbname',
'uname': 'testuser123',
'pass':'test123'
};
x = createobject("component","pages").init(db)
</cfscript>