I've had the same thing happen before.
Are you using the default JS editor or an external editor? And does the doc contain a large number of related fields?
Yes, I've experienced it as well. Mostly when using one of the built-in functions for calculation/validation/keystroke/etc.
The code usually works, although it's not displayed in the window, though.
Huh? This doesn't really answer any of the questions asked above...
Yeah, I was hoping it would still work, but it doesn't seem to. It does appear to happen more often when I have multiple files open that share the same field names but are not actually connected... That is not *always* the case, though... I don't think.
I must not have understood the question. I am scripting this through Adobe Acrobat Pro XI while in the Properties of the Text Field. I assume that is the default editor to which you are referring, but I am new(ish) to Adobe and JS. And there are definitely a large number of fields in the doc, but not many are necessarily related. All are either Text Fields or Check Boxes.
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.
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.
Thank you very much for that response, Thom. I have slowly been picking up Java and Adobe over the past year and really do need to get into some sort of class for it. I will take your suggestions into account moving forward. If I learn more through trial/error, I will add what I can to this thread. Do you know of any other threads already started out there that might have some other "solutions" that I should avoid repeating, haha
There also used to be a site dedicated to Acrobat users, www.acrobatusers.com
This site is no longer maintained, but all the info is still there. Here's a link to the listing of JS tutorials
Let me first wholeheartedly recommend Thom's PDFScripting.com site. You will find a lot of really useful information on that site.
1 person found this helpful
I just encountered what seems to be this same problem myself, and noticed that I cannot switch the calculation type to a full script, if I select the field from the fields list - I can switch to using a script for a given field if and only if I first select that field on the document display itself (the layout window). After this is done, I seem to be able to modify the script just fine by selecting the field in the field list or in the document layout area. to anyone having this type of issue, it might be worth a try to see if that is something that helps (?)
So, the problem is when I try to select the field in the fields list, right click, select Properties > Calculate > Custom calculation script > Edit then add scripting code and click OK -- the Custom calculation script radio button is deselected and the script box is left empty.
My solution so far is to select the field in the layout display (where you position and preview the fields and document text) then right click on the field there, then select Properties > Calculate > Custom calculation script > Edit then add scripting code and click OK -- the code persists and the correct radio button remains selected. Further, once this is done, I can then select various other fields and return to this field in the field list, editing the Calculate settings and changes will persist
Certainly seems like a bug to me
I will keep this in mind, as well. Thanks, Brett!