The reason I asked about the editor is because Acrobat only loads the edited code when the external editor is fully closed. So you can lose a lot of entered code if your not careful how the process is handled. But this isn't your issue. I experienced this problem when switching between fields without closing the field properties window, and also, as try67 mentions, when using the predefined operations. These predefined operations are actually just predefined JavaScript templates. I believe there is a timing issue when Acrobat opens the calculation tab, that causes the selection logic to get confused as to the actual state of the code. Acrobat sets the wrong state, which results in the code being deleted. I think it's timing because it only seems to become an issue when there are a lot of related fields that I'm switching between. A good example of when this is a table of fields, like you'd have on an order form. In this case I'd use group naming, which puts several fields on the same AcroForm path, and I'd also use mixed calculation types, such as the "Sum" operation for the total, and a custom JS calc in other locations. And of course I'd be quickly switching between the different fields to make sure they were all setup properly. If the properties window is left open, and the field focus is switched from the sum field to a field with a JS calc, then sometimes the calculation type selection will stay the same, and the JS calc is lost. The solution is to close the properties window before selecting another field and then reopening the properties. Try this and see if it helps. This issue is probably more complicated than just a timing issue, and you may be experiencing it differently than I did. But it's something that has happened in several different versions of Acrobat. I don't think they've fixed it because it's not consistently repeatable.
... View more