When working with buttons on a form, we often add rules. You access the rules editor from the properties of the button.
When clicking around quickly, it’s easy to accidentally click on “Edit Form Code” instead of “Rules …”.
The first time I did this, I canceled out of the code editor. However, when I tried to publish the form a little while later, it required that I publish as an “Administrator-approved form template (advanced)”. I didn’t actually do any programming and I absolutely didn’t want to go through an unnecessary approval process. I was in a bit of panic at the time due to time constraints. To get past it, I simply restored a previous backup and continued. I had recently seen some blog posts about people going into the form’s XML to tweak things and I was afraid I would have to do something similar.
Today, I did it again. This time, I had a little more time on my hands and found that you can easily undo this.
Tools -> Form Options -> Programming: “Remove Code”
It does not get much easier than that.