I was writing a bit of Javascript yesterday when I noticed something interesting related to the value of the crmForm.FormType property.

The crmForm has a property called FormType, which allows you to distinguish between the different types of forms you may encounter as a user creates or edits a CRM Entity.

When a user clicks the New button to create a new Entity, the FormType is set to 1, for Create Form.  If the user clicks the Save button ( not Save and Close ), CRM will save the record, as expected.  From that point forward, CRM considers the user's operation to be an Edit of existing data, rather than the entry of New data.

Subsequently, the FormType is changed to reflect that fact: After the Save button is clicked, the FormType is changed to 2, for Update Form.

I've only had to track the FormType in very rare instances but this is something that you need to keep in mind if you ever need to differentiate between Create and Update, and if you ever expect the user to save their data, but keep the form open to continue editing.

References:

http://blogs.infinite-x.net/2007/03/19/verifying-form-context-before-invoking-javascript-code/