Subject Re: [IBO] BeforePost called when deleting
Author Helen Borrie
At 12:15 AM 12/03/2003 +0000, you wrote:
>Hi there,
>Can someone please explain to me why a TIB_Query's BeforePost event
>is fired when I delete a record?

All DML changes require to be posted. Until Post is called, no request is
passed to the server.

Post causes the request to be written to the server and (if successful) to
block all other DML requests in respect of that record. After posting
successfully, the request can be either committed or rolled back. If your
transaction has AutoCommit true, then a successful Post will be followed by
an immediate commit(retaining), with no chance to rollback.

>I can understand why it may be called once the deletion has taken
>place, but it is being called before my ConfirmDeletePrompt is

No, BeforePost happens BEFORE the code proceeds to Post. Here you can
intervene and do stuff like client-side validation...though it's pretty
unusual to need to do any BeforePost handling for a delete, over and above
what IBO does itself.

If you do need to write a BeforePost handler, you can make the
ConfirmDeletePrompt action take place first, by beginning your handler code
with the keyword "inherited". If you don't have any handler code for this
event, it just moves on to the built-in BeforePost action, which includes
ConfirmDelete, if you have set it true.