NetTalk Central

Author Topic: Closing form with X does not run code in Cancel embed  (Read 3745 times)

nevy

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Closing form with X does not run code in Cancel embed
« on: August 27, 2011, 03:31:33 AM »
Bruce,

Closing form with X does not run code in Cancel embed. If I push the cancel button it is executed.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Closing form with X does not run code in Cancel embed
« Reply #1 on: August 27, 2011, 05:09:31 AM »
Correct. That's partly deliberate.
the Cancel embed is really just there for comfort value, you can't put any really "serious" code in there.

Why not? Well because the user may just turn off their browser, they may type in another URL, or they may just choose another menu item. Navigation in a browser is always forwards, and you can't _guarantee_ a certain path through the program the way you can with windows.

You are therefore better off "handling" the Cancel in a more "complete" way.

So, start by assuming that if you do the "Insert on form open" approach (which you have to do if you want to add Child records when inserting the parent) then you should also have some sort of "completed" field. When the user clicks on _save_ the record becomes "real".

Some people use a temp table for this, copying the record to the actual table when it is saved, but personally I don't do that. Rather I just use a single "real" field, and have a background process that cleans out "old, unreal" records from time to time.

Cheers
Bruce

nevy

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Closing form with X does not run code in Cancel embed
« Reply #2 on: August 27, 2011, 05:33:57 AM »
Thanks Bruce,
That makes sense, I was just trying to clean up the ident record left by the X factor. So I put some Prop:SQL in the  to delete all records with logno=0. It works so it is just a process to clean up behind myself.
I will wait for your findings on the ident that is left behind.