How do I determine what mode a form is in?

I have seen this thread…

http://www.scriptcase.net/forum/showthread.php?5076-How-to-determine-the-form-Mode&highlight=form+mode

…but it doesn’t help.

Can anyone tell me how, from within a form, I can tell what mode (insert or edit) the form is in?

Afaik, you cannot.

Wow. That’s not good.

If I choose to edit a record from a grid the form header will say “Editing”
If I choose to add new from a grid the form header will say “(New Record)”

So the form obviously knows.

Alternatively, is it possible to call a php method when a button is pressed before the form is loaded?

No, not in a grid. But why not take matters in your own hands and create the buttons.
You can pass a parameter and know exactly where you’re at.

jsb