I have a XML PDF form with a number of fields, including a few which auto-populate as per a script (e.g. today's time, today's date). Every time I open the (unsubmitted) form, these fields update as per the system date/time. This is expected.
I want all fields to lock when the user presses the submit button at the end of the form. Currently, even after the form is submitted, the PDF keeps updating those fields every time it is opened!
I am sorry I kind of mislead you here, as I thought you were handling things a bit differently.
By the look of how you are doing things it is much simpler than I said.
Technically there would be two things you need to consider, because I found an error while trying to fill in your form.
1st: As soon as the user hits submit and there's a field in the form that isn't valid, the form will stay read only because you set it "protected" inside the preSubmit event of the submit button.
2nd: To avoid fields to be calculated every time the form is open once the form is locked, all you need to do is add a condition inside the calculate event of those fields like the following:
if (form1.access eq "open") then
The code above matches the FormCalc that's used inside the calculate event of Current date and Current time.
I hope this will help, let me know if you need anything else.