I want to provide additional server-side validation of the address forms in Magento, both in Checkout and Customer. I can override
Mage_Customer_AddressController, but that seems a bit much, and I would have to explicitly include the controller path, which seems dirty.
If I rely on the events system and do my validation after the appropriate controller action I might have to actively undo things done by the controller, such as remove session messages or delete or change addresses in the session. (I'd also be relying on the events system being synchronous, which while true seems dirty, and I'd be relying on order of events if other events affect what I'm working on.)
I suppose the best bet would be to override
Mage_Eav_Model_Form->validateData(). The only problem with that unlike some of the above options it only gives me the opportunity to set error messages, and sometimes you want to modify the actual JSON data going back (for example, to give the user the ability to choose among alternatives).
When I researched how to do this Google turned up results about overriding client-side validation, but there doesn't seem to be much about server-side. Is there a generic right way to do server-side form validation overrides?
Update: I also discovered there is a callback registry for
Varien_Object->save(), but it only happens after the save. If there were a callback that happens before the save it would serve, but I didn't see anything like that.