When Is Validation Triggered
When Is Validation Triggered
- Subject: When Is Validation Triggered
- From: Kevin Hinkson <email@hidden>
- Date: Fri, 03 Jun 2011 12:54:01 -0400
Hi, I've implemented the following on an EO:
public void validateForSave() throws NSValidation.ValidationException { public String validateEmail(String newEmail) throws NSValidation.ValidationException {
validateEmail I assume is called by validateValueForKey so I can apply attribute specific checks. When one of my checks fail I do:
throw new NSValidation.ValidationException("Please enter a valid email address.");
In either case (with only one enabled at a time) validateForSave and validateEmail can be seen throwing an exception which I log but this is only thrown after the EO is inserted into the database which is done by saving the editing context. Is this how it is supposed to work? I thought that these would be triggered before insert: http://wiki.objectstyle.org/confluence/display/WO/EOF-Using+EOF-Validation and either would prevent insertion.
Am I doing it wrong? |
_______________________________________________
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