1)Make a global boolean in the module
2)Set it to false on load
3)set it to true when button is clicked
4)create if then logic for turning edit off and on based on boolean
Just for the flair of it maybe you could try to:
5)Change the text on the button: Edit if it's locked, Update if it's unlocked.
this way future generations won't be wondering where the magic occurs.