How to set form to "clean" and get the "Submit" button to appear?

I have a need to re-load external data in my after-save event handler.

Unfortunately, this sets the form to “dirty”. The “Submit” button appears momentarily, but is quickly replaced by the “Save” button.

How can I clear the is_dirty flag and get back the “Submit” button?

Using JavaScript:

frm.doc.__unsaved = false;

Using Python:

if hasattr(some_doc, "__unsaved"):
    delattr(some_doc, "__unsaved")

…or alternately…

if hasattr(some_doc, "__unsaved"):
    some_doc.__unsaved = False
3 Likes

I’ve been hacking away at this for hours and hours.

Your answer is helpful. My question was misguided.

The problem has nothing to do with external data, nor with the dirty flag.

The root cause is a nasty work around I attempted as a way to solve a different problem.

I’m asking about it in a different question: What happens after "after_save" and before first user action