validatating to-many relationship
validatating to-many relationship
- Subject: validatating to-many relationship
- From: Markus Ruggiero <email@hidden>
- Date: Fri, 01 Nov 2013 13:11:58 +0100
I have D2W application where we have a to-many relationship. This relationship is displayed by a custom component. The user can check the desired destination objects (there are only 5 available). It is required that at least one checkbox must be ticked. In the EOModel the to-many relationship is set to not null.
Default handling (validateForSave) returns an exception text "The relationship must have at least one assignment of type ?". Obviously EOF is not able to figure what the destination is and displays a question mark. I tried to implement validateIndustryProducts() but this method is never called. Overriding validateForSave and NOT calling super.validateForSave works but this does not feel right. How can I validate that relationship properly?
Model Details: There is a qualified many-to-many relationship between a product and an industry. A product must be assigned to at least one of the 5 industries. For each assignment the user must give a free text primary use for that product in that assigned industry. The qualified join entity is called IndustryProduct and thus the relationship on product is called industryProducts. Here is my code from Product that does not get called:
public Object validateIndustryProducts(Object value) throws ValidationException { if (industryProducts() == null || ((NSArray)industryProducts()).count() == 0) { throw new ValidationException( "At least 1 industry must be assigned" ); } return value; }
What do I miss?
Thanks a lot ---markus---
|
_______________________________________________
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