main logo
Subject: Re: Delete PreHook and Confirmation
Author: Bhavbhuti Nathwani
Posted: 2002/02/15 23:47:44
 
View Entire Thread
New Search


Thanks Ed. for patiently answering all my queries.

Yes I had noticed BeforeDelete() in both the places. But I opted for the BO based BeforeDelete() so that the concepts of CB are maintained. And I never thought about it in the manner you have explained. This.oBizobj.BeforeDelete()
This call in Forms BeforeDelete() will do the job. If I am not mistaken all the forms BO will be queried with this call and the respective messages will be flashed and if I have a false as a return value and I am done, thanks.

And yes I had meant it in fun thus the <g> ;-)

<i><font color="#663300"><i><font color="#663300">The BO question for delete "Are You Sure you want to Delete this Record?" happens before the BeforeDelete(). Actually the BeforeDelete() should be allowed to do all it's validations and messages and only if cleared by the BeforeDelete() should the question "Are You Sure you want to Delete this Record?" I feel it can be frustrating to the unsuspecting user.</font></i>

The bizobj doesn't ask the question; the form does. The form has its own BeforeDelete() hook.

You should understand the flow of events in the situation where the users selects "Delete". Since this is a potentially destructive act, we need to first confirm that they intended to select "delete". Then, once we are sure that they intended to delete, we then call the bizobj's Delete() method, where business rules are applied to determine if a deletion should be allowed. If there is no reason to prohibit deletion, then and only then is the data behavior's Delete() called, which actually deletes the record.

<i><font color="#663300">What I feel is that when the user selects File | Delete the first thing he should see is "Cannot Delete default records", etc. and the control should return to the form. If the criteria is met then the "Are You Sure you want to Delete this Record?" question is to be popped.</font></i>

That's easy enough to do yourself. In that form's BeforeDelete() method, make a call to This.oBizobj.BeforeDelete(), and if that value is false, display your custom message to the user.

<i><font color="#663300">Ed, I appreciate your efforts for CB and I am just letting you know about my observations (3 or 4 digests full of them) and would not want to monopolize the product or preferences or efforts. The above, all my previous posts and even the future ones may seem trivial and irritating but are in good faith.</font></i>

Not at all. I assume that there are other newcomers to Codebook who may have had similar misunderstandings as to the design of the framework, and that your questions may have cleared things up for them, too. Unless you understand the design of the framework, it's hard to tell the difference between a bug and a design choice.

One thing to always keep in mind when working with any framework is that it is built to perform a certain way. If you need your app to perform differently, you need to be able to identify where to make your customizations. The whole point of having hook methods such as all the Before*() and After*() methods is to provide convenient places for you to customize the framework at these critical junctures without having to modify the framework directly.

<i><font color="#663300">CB is a fine product and does a lot many things that either I would have to reinvent or pay a handsome sum for. So pluheessee, pluheessee don't boot me out from the community <g>.</font></i>

I know that was meant in fun, but keep in mind that I can't boot anyone out of anything. Codebook is a free and open framework; I just happen to be the one doing all of the maintenance work on it right now.
</font></i>

Regards
Bhavbhuti
 
©2002 Bhavbhuti Nathwani
<-- Prior Message New Search Next Message -->