Hi Ted, There's no validation exception handling on the list pages. To work around this, you can implement something like this on the EO:
@Override public boolean canDelete() { boolean canDelete = super.canDelete(); if (studentCount() > 0) { canDelete = false; } else if (ERXEOControlUtilities.objectCountWithQualifier(editingContext(), Course.ENTITY_NAME, Course.PREVIOUS_COURSE.eq(this)) > 0) { canDelete = false; } return canDelete; } If the method returns false, the button will be deactivated. Still, the user has no way of knowing why the object cannot be deleted… Fabian > Am 15.02.2019 um 18:43 schrieb Theodore Petrosky <tedp...@yahoo.com>: > > I have a small d2w project. > > Person has a to-many relationship to DocuentScan. In my Person entity I see > the documentScans relation. I set the Delete Rule to deny. So if I try to > delete a person, and there are Document Scans attached, the transaction will > be aborted and there will be an error message. > > OK, so user ‘Ted' has some documentScans attached. I click to delete the user > and I get the normal confirmation box. I click the delete to confirm and > instead of returning me to the previous screen with a warning, I get an error > in Eclipse. here is the top few lines: > > WARN NSLog - <er.ajax.AjaxRequestHandler>: Exception occurred while > handling request: > <er.extensions.validation.ERXValidationException object: <com.as.Model.Person > pk:"1">; propertyKey: documentScans; type: ObjectsRemovalException; > additionalExceptions: ()> > [2019-2-15 12:21:5 EST] <WorkerThread7> > <er.extensions.validation.ERXValidationException object: <com.as.Model.Person > pk:"1">; propertyKey: documentScans; type: ObjectsRemovalException; > additionalExceptions: ()> > at > com.webobjects.eoaccess.EOEntity.validateObjectForDelete(EOEntity.java:4190) > at > com.webobjects.eoaccess.EOEntityClassDescription.validateObjectForDelete(EOEntityClassDescription.java:521) > at > er.extensions.eof.ERXEntityClassDescription.validateObjectForDelete(ERXEntityClassDescription.java:700) > at > com.webobjects.eocontrol.EOCustomObject.validateForDelete(EOCustomObject.java:1419) > at > com.webobjects.eocontrol.EOEditingContext.validateTable(EOEditingContext.java:2274) > > and this is the top of my browswer: > > Application: AS_Document_Safe > Error: <er.extensions.validation.ERXValidationException object: > <com.as.Model.Person pk:"1">; propertyKey: documentScans; type: > ObjectsRemovalException; additionalExceptions: ()> > Reason: Cannot delete this <b>Person</b>. You should first delete the > items in its <b>Document Scans</b>. > OK, Am I missing some rule somewhere? > > Since I was looking at a ListPerson page, I expected the ‘Reason’ to be at > the top of the table. > > Anyone have any solution here? > > Ted > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com > > This email sent to lists.fab...@e-lumo.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com