validating multiple EOs attached to a form
validating multiple EOs attached to a form
- Subject: validating multiple EOs attached to a form
- From: "Dr. Wo" <email@hidden>
- Date: Wed, 01 Feb 2012 11:38:53 -0500
I'm curious to know whether what I am doing is recommended practice for validating multiple EOs attached to a form and, not incidentally, whether I understand how validation is intended to work.
I have a form that has fields that are linked to multiple EOs, one of which is the "principal" entity, the others being related to it. (However, the situation I describe would arise even if there are no relationships among the entities.) It seems that when I invoke save and the EOs are validated, the first one that throws a validation exception terminates the validation process such that any remaining EOs will not be validated. Simply put, from the user's perspective not all invalid data will be caught.
The way I handle this problem is to have an editing context delegate perform the validation via editingContextShouldValidateChanges. Before returning false from this method I take over the validation process by validating all the updated EOs in the EC and I throw an aggregate validation exception if needed. I use the methods in ERXEntityClassDescription to perform the validation.
Is this a recommended method, or is there a preferred alternative? And in any case, do I understand the process correctly?
Thanks
Tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden