On Feb 11, 2013, at 10:51 AM, James Cicenia wrote:

> Since this project is new and I want to try to work with all the best 
> practices, I now need to pay attention to validation.
> 
> Is there a good wiki page I should read or a video I should watch?

I don't think there's any one stop that explains it all. Here's a brain dump:

Adding validation to your EOs

http://developer.apple.com/legacy/mac/library/documentation/WebObjects/Enterprise_Objects/BusinessLogic/BusinessLogic.html#//apple_ref/doc/uid/TP30001011-CH204-TPXREF141

The javadoc on NSValidation has additional info

https://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSValidation.html

Wonder extends this with ERXValidation stuff which provides localized 
validation error messages. This is why we have a ValidationTemplate.strings 
file.

Wonder adds additional validation magic also in the ERXEntityClassDescription 
class. There's documentation on it in the javadoc.

http://jenkins.wocommunity.org/job/Wonder/javadoc/er/extensions/eof/ERXEntityClassDescription.html

Those javadocs mention the Validity framework. AFAIK, Validity still works, but 
nobody uses it. It requires you subclass a special implementation of 
EOGenericRecord in your EO templates. GSVGenericRecord is not actually a 
subclass of EOGenericRecord. 

Validity creates a sort of rule-based approach to validation and the rules were 
stored in the EOModel. I always liked the idea, but never found time to explore 
it and port its functionality into ERXGenericRecord. The wonder stuff is Good 
Enoughâ„¢ for me. It's now relegated to the archives. There is some documentation 
in the Validity framework.

Chuck Hill did an interesting presentation on validation years ago with a mind 
to improve validation further. The link on wocommunity points to 

http://wocommunity.org/podcasts/wowodc/west09/WOWODCW09-Validation.mov

but that appears to be broken. Pascal can probably give you the correct link.


> I am mixing D2W with Custom Components and I notice something like 
> parent().validationFailedWithException(e,obj,key).
> 
> How is that rolled into the actual parent page to show the exception?


In ERD2W, all validation exceptions are passed up to parent.  The only class 
that actually implements validation in the ERD2WPage class. A d2w page may 
display the exceptions, or it may pass them further up the chain to the next 
D2W page in the case of embedded pages. 

Last year, I believe it was Fabian Peters who prodded me to fix a bug in the 
validationFailedWithException on ERD2WPage. I decided 
validationFailedWithException was simply too overloaded to fix without breaking 
someone's stuff. I added a validation delegate. 

Now you can add a custom delegate to handle validation any way you please in 
d2w.  I've gone so far as add validation on a to-many relationship to allow 
multiple object editing and provide individual validation error messages on 
each object in the list. You can see that in the ERUsers framework when you are 
editing challenge questions in the user creation process.

> 
> Thanks
> James
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
> 
> This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to