I'm having some issues with Reactor validation. The user variable is a reactor record object. This is the scenario where I'm editing user information and saving the changes back to the DB. This anomaly occurs whether I actually have changes to save or not (i.e., I can just open the edit form, and do nothing but click save; or I can open the edit form, make changes, and click save).

<cfset arguments.event.trace("errors:", user.validated())>
<cfset user.validate()>
<cfset arguments.event.trace("errors:", user.validated())>
<cfset arguments.event.trace("errors:", user._getErrorCollection ().count())>
<cfset arguments.event.trace("errors:", user.hasErrors())>
<cfset arguments.event.trace("errors:", user._getErrorCollection ().getErrors())>
<cfif NOT user.hasErrors()>
        <cfset user.save()>
        <cfset arguments.event.addResult("editSuccess")>
<cfelse>
<cfset arguments.event.setValue("editErrorCollection", user._getErrorCollection())>
        <cfset arguments.event.addResult("editError")>
</cfif>

When the code above runs, I'm seeing the output below from Model-Glue debugging:

16ms    errors:         NO
        
8672ms  errors:         YES
        
8672ms  errors:         0
        
8672ms  errors:         true
        
8672ms  errors:         array [empty]
        
So the way I read that, the validated state is being set properly, there are no errors on the user object, but for some reason hasErrors () is returning true. Can anyone help me here? I've loaded up records outside my application (with a test CFM page) and they validate correctly (at least as I see it---the error collection count () returns 0 and hasErrors() returns false).

Thanks!

Clint Miller




-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to