So I have a viewlet handler with a single function:
It checks for all objects in the PRC that contain a hasErrors() function, this works great.
function showValidationErrors( event, rc, prc ){
// Get structure of items that contain a hasErrors function, we assume that these are validationResult objects
return renderview( view="viewlets/showValidationErrors", collection=structFindKey(prc, "HasErrors", "all") );
}
My page is also quite simple:
<cfoutput>
<cfif showValidationErrors.owner.hasErrors()>
#cbMessageBox().renderMessage( type="error", message=showValidationErrors.owner.getAllErrors() )#
</cfif>
</cfoutput>
I have a page where I want to display this info:
mypage.cfm:
<cfoutput>
Some text before
#runEvent(event="viewlets.showValidationErrors")#
Some text after
</cfoutput>
I don’t see anything even if content is rendered, for example, if I place a cfabort tag I do see the proper result, I see rendered the string “Some text before” and then the error message :
<cfoutput>
<cfif showValidationErrors.owner.hasErrors()>
#cbMessageBox().renderMessage( type="error", message=showValidationErrors.owner.getAllErrors() )#
<cfabort>
</cfif>
</cfoutput>
I also tried just entering some plain text in the viewlet to see if the issue was with the cbMessageBox content:
<cfoutput>
<cfif showValidationErrors.owner.hasErrors()>
#cbMessageBox().renderMessage( type="error", message=showValidationErrors.owner.getAllErrors() )#
some plain text here
<cfabort>
</cfif>
</cfoutput>
So I know that the viewlet is being executed and properly rendering content, but the content does not appear in the final rendered page.
I also tried adding the runEvent() command in my layout pages also no result.