Yep... (me...again!)
I am trying to troubleshoot some errors and when I go to dump allErrors() in my controller, it is simply an empty array, when I know for a fact it shouldn't be.
link.cfc (model)
<cffunction name="init">
<cfset validate(property='linkURL', method="validateUniqueUrl", when="onCreate") />
</cffunction>
<cffunction name="validateUniqueUrl" access="public">
<cfif this.exists(where="linkURL='#this.linkURL#'")>
<cfset this.addError(property="linkURL", name="linkExists", message="The link you entered already exists.") />
</cfif>
</cffunction>
If the link exists, I get the error correctly in my view:
<cfoutput>#errorMessagesFor("link")#</cfoutput>
However, in my controller, I want to dump all errors on the model by doing:
<cfdump var="#link.allErrors()#" abort />
Just a blank array! WTF?!
Even if I then try:
<cfdump var="#link.errorsOn("link")#" abort />
...again, an EMPTY array.
What in the world is going on here? Am I being an idiot or something?
Thanks. Michael.
UPDATE:
Ok, so it seems using <cfdump var="#link.allErrors()#" abort />
in my view works, but not in the controller? Why not? I need this in the controller so that I can then make a redirect!