<!--- has this campaign been assigned to this contact yet --->
<cfset
isUnique(arguments.ccRecord)>
That should be:
<!--- has this campaign been assigned to this contact yet --->
<cfset isUnique(arguments.ccRecord, arguments.ErrorCollection)>
Doug
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Vega
Sent: Friday, July 14, 2006 10:18
PM
To: [email protected]
Subject: [Reactor for CF] custom
validation
I am doing some custom validation and for some reason my
ErrorCollection is being reset. When the code gets t b
errorCollection.getErrors() show the error i have added, when it returns to
point a arguments.errorCollection is reset, anyone know what im doing wrong?
<cffunction name="validateCampaignId"
access="public" output="true"
returntype="reactor.util.ErrorCollection" hint="I will make sure
duplicate campaigns are not assigned to a contact">
<cfargument name="ccRecord"
required="false"
type="reactor.project.cm.record.ccRecord">
<cfargument
name="ErrorCollection" hint="I am the error collection to
populate. If not provided a new collection is created." required="no"
type=" reactor.util.ErrorCollection"
default="#createErrorCollection(arguments.ccRecord._getDictionary())#"
/>
<cfset
super.validateCampaignId(arguments.ccRecord,arguments.ErrorCollection )/>
<!--- has this campaign been assigned
to this contact yet --->
<cfset
isUnique(arguments.ccRecord)>
<!--- a --->
<cfreturn
arguments.ErrorCollection>
</cffunction>
<cffunction name="isUnique"
access="public" hint="I validate that the username field is
unique" output="true" returntype="
reactor.util.ErrorCollection">
<cfargument name="ccRecord"
required="false"
type="reactor.project.cm.record.ccRecord">
<cfargument
name="ErrorCollection" hint="I am the error collection to
populate. If not provided a new collection is created."
required="no" type=" reactor.util.ErrorCollection"
default="#createErrorCollection(arguments.ccRecord._getDictionary())#"
/>
<cfset var ccGateway =
_getReactorFactory().createGateway("cc") />
<!--- returns false if the combination
of contact/campaign already exists in 1 record --->
<cfif NOT
ccGateway.isUniqueCampaign(arguments.ccRecord.getCampaignId(),arguments.ccRecord.getContactId
())>
<cfset arguments.ErrorCollection.addError("The
campaign has already been assigned to this contact") />
</cfif>
<!--- b --->
<cfreturn arguments.ErrorCollection
/>
</cffunction>
--
Dan Vega
[EMAIL PROTECTED]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|