Hi there

Thanks for the reply - I ended up with something very similar.

Its almost working - but getting an error (shown below)

The SUBURBID argument passed to the memberSave function is not of type 
suburbID.  
If the component name is specified as a type of this argument, its possible 
that a definition file for the component cannot be found or is not accessible.

Any idea?  







> Toby,
> 
> Create a file called 'member.cfc' and then copy the content below into 
> it.  Call it like so:
> 
> <cfset myresult = createObject("component", "member").memberSave(form, 
> request.AppDS, request.suburbID)>
> 
> That will send your form scope and request variables into the function 
> and return your return_trac_result var as "myresult".  Also, please, 
> please use CFQUERYPARAM around all those variables in your inserts!!
> 
> <cfcomponent displayName="member">
> 
> <cffunction name="memberSave" access="public" returntype="numeric" 
> output="no">
>       <cfargument name="formStruct" type="struct" required="yes">
>       <cfargument name="dsn" type="string" required="yes">
>       <cfarguemnt name="suburbID" type="suburbID" required="yes">
>       
>       <cfset var formArgs = arguments.formStruct>
>       <cfset var selemailopt = "">
>       <cfset var CustParams = "">
>       <cfset var return_trac_result = "">
>       
>       <cfif structKeyExists(formArgs, "mailList") AND formArgs.mailList NEQ 
> "">
>               <cfset selemailopt = 'I'>
>       <cfelse>
>               <cfset selemailopt = 'O'>
>       </cfif>
>       
>       <!--- Assumptions 
> 
>       Mobile - is empty as this data is not collected
>       Title - is empty as this data is not collected
>       Active - is set to False until such time as the user has been 
> approved
>       2696812 - is set to NSW by default although it could be set to 
> #trim(form.state)#
>       
>       --->
> 
>       <cfset CustParams = "FIRSTNAME|" & trim(formArgs.FirstName) & CHR(31) 
> 
>               & "LASTNAME|" & trim(formArgs.LastName) & CHR(31) 
>               & "EMAIL|" & trim(formArgs.Email) & CHR(31) 
>               & "MOBILE|" & "" & CHR(31)
>               & "TITLE|" & "" & CHR(31)
>               & "EMAILOPT|" & selemailopt & CHR(31)
>               & "ACTIVE|" & "F" & CHR(31)
>               & "PASSWORD|" & trim(formArgs.password) & CHR(31) 
>               & "2969822|" & trim(formArgs.country) & CHR(31)
>               & "2969812|" & trim(formArgs.state) & CHR(31)
>               & "2969824|" & trim(formArgs.gender) & CHR(31)
>               & "2969828|" & trim(formArgs.UserAge) & CHR(31)
>               & "2969811|" & trim(formArgs.fldPostLookup) & CHR(31)
>               & "2969823|" & trim(formArgs.postCode) & CHR(31)
>               & "2969830|" & trim(formArgs.fldPostLookup2) & CHR(31)
>               & "2969831|" & trim(formArgs.postCode2) & CHR(31)>
>       
>       <!--- Additional code to add new community member details to traction 
> --->
>       
>       <cfhttp method="post" url="http://au.api.tractionplatform.
> com/ext/AddCustomer" result="myTest">
>               <cfhttpparam name="USERID" type="formfield" value="street1231">
>               <cfhttpparam name="PASSWORD" type="formfield" value="asdh4523">
>               <cfhttpparam name="ENDPOINTID" type="formfield" value="6906">
>               <cfhttpparam name="MATCHKEY" type="formfield" value="E">
>               <cfhttpparam name="MATCHVALUE" type="formfield" 
> value="#formArgs.
> Email#">
>               <cfhttpparam name="CUSTOMER" type="formfield" 
> value="#CustParams#"> 
> 
>       </cfhttp>
>       
>       <!--- Get the return ResultCode (Trac-Result) --->
>       
>       <cfset return_trac_result = myTest.Responseheader['TRAC-Result']>
>       
>       <cftransaction>
>       <CFQUERY DATASOURCE="#arguments.dsn#">
>               INSERT INTO SC_Trac_Results
>                       (TR_ResultCode,
>                       TR_CustParams,
>                       TR_Date)
>               VALUES
>                       (#return_trac_result#,
>                       '#CustParams#',
>                       '#trim(form.CreateDate)#')
>       </CFQUERY>
>       
>       <CFQUERY DATASOURCE="#arguments.dsn#">
>               INSERT INTO SC_Metro_Users
>                       (FirstName, 
>                       LastName, 
>                       suburbID, 
>                       Email, 
>                       <!---PhoneNumber, --->
>                       city,
>                       ZipCode, 
>                       country,
>                       gender,
>                       UserAge, 
>                       Login, 
>                       Password, 
>                       signature, 
>                       backnews, 
>                       mailList, 
>                       ThirdEmail, 
>                       TOS, 
>                       BizLogin, 
>                       BizNews, 
>                       Staff, 
>                       CreateDate, 
>                       FirstLogin, 
>                       HasPosted)
>               VALUES 
>                       ('#trim(formArgs.FirstName)#', 
>                       '#trim(formArgs.LastName)#', 
>                       '#trim(arguments.suburbID)#', 
>                       '#trim(formArgs.Email)#', 
>                       <!---'#trim(formArgs.PhoneNumber1)#-#trim(formArgs.
> PhoneNumber2)#-#trim(formArgs.PhoneNumber3)#', --->
>                       '#trim(formArgs.fldPostLookup)#',
>                       '#trim(formArgs.postCode)#',
>                       '#trim(formArgs.country)#',
>                       '#trim(formArgs.gender)#', 
>                       '#trim(formArgs.UserAge)#', 
>                       '#trim(formArgs.Login)#', 
>                       '#trim(formArgs.Password)#', 
>                       '#trim(formArgs.signature)#',
>                       '0',<!---<cfif structKeyExists(formArgs, "backnews") 
> AND formArgs.
> backnews NEQ "">'#trim(formArgs.backnews)#',<cfelse>'0',</cfif> --->
>                       <cfif structKeyExists(formArgs, "MailList") AND 
> formArgs.MailList 
> NEQ "">'#trim(formArgs.mailList)#',<cfelse>'0',</cfif> 
>                       <cfif structKeyExists(formArgs, "ThirdEmail") AND 
> formArgs.
> ThirdEmail NEQ "">'#trim(formArgs.ThirdEmail)#',<cfelse>'0',</cfif>
>                       <cfif structKeyExists(formArgs, "TOS") AND formArgs.TOS 
> NEQ 
> "">'#trim(formArgs.TOS)#',<cfelse>'0',</cfif>
>                       '0',
>                       '0', 
>                       '0', 
>                       '#trim(formArgs.CreateDate)#', 
>                       '#trim(formArgs.FirstLogin)#', 
>                       '0')
>       </CFQUERY>
>       </cftransaction>
>       
>       <cfreturn return_trac_result>
> 
> </cffunction>
> 
> </cfcomponent> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314619
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to