I am taking over a project that another developer finished. It was created using Yii, which I’m not very familiar with.
I would like to be able to see when users submitting forms on my site run into any validation errors. Is there anyway to easily log this information so I can see any errors users receive, along with the data they entered which triggered the error?
Minor note: I’d not override onAfterValidate() but afterValidate(). The latter was built for this purpose. If you don’t do that, your event may not trigger correctly anymore. This could matter if you e.g. attach a behavior which tries to attach another handler to this event. And you should call parent::beforeValidate() from your override method.
I was able to get the logging to work to a file, but not email. That’s good enough.
I’ve read through the docs on logging, but I cannot seem to figure out how to make it show an error when a JavaScript form error occurs. Is this possible? The only thing I could get to work is logging server-side errors or record when an ajax request is made, but I can’t see the errors that the visitor gets when trying to fill out a form.