I am embarrassed to ask this question because I am self taught on JS and using the console for error debugging - and I taught myself on Pro 9 - however overnight, my office has upgraded me to Pro 2017 and now I find the the console / debugger completely useless. Instead of telling me which field has the issue, I now only see:
TypeError: this.getField(..) is null
In the button I hit (which was a reset button) I have dozens of fields that are set to do certain things on reset - it used to say for example:
this.getField("HolderOne") is null
so I knew exactly where the issue was. I kind of use it throughout the document and to test each execution as I create it. I don't really work in the document level script, I use the properties to add my script in.
Could anyone possibly suggest how I can use this kind of error message to actually find my problem? Do I have a setting wrong? I lot of the time I am having a stab in the dark at getting a calculation script or something like that working and this was the only way I could get myself on the right track - by interpreting what was spat out on the console.
I have searched and searched all day all over the the net to try and find anything, but I can't see anything at all...
Please help if you can!!
Unfortunately, this is indeed a serious issue with the functionality of Acrobat DC, especially for developers.
The only solution is to use your own code to perform all calculations and add specific error messages with the field-name when this situation happens.
The correct way to write code is to use error handling techniques, such as testing values that might be problematic and using exception handling. It's also a good idea to test you code as it is being written. Good debug tools are nice, but you shouldn't use them as a crutch for bad coding practices.
To that end, your problem appears to be an invalid field name. At some point you entered code that was incorrect to begin with. How many calculation scripts did you enter before testing? The error will be in your latest set of updates.
This error message usually comes from the built-in Calculation functions (Sum, Product, etc.) and it is an excellent example of extremely poor error-handling by the Acrobat developers, as it fails to provide the most crucial bits of information:
1. Where the error happened? (under which field's calculation event)
2. What caused the error? (what was the invalid field name)
Thanks so much to you both.
Yes, @Thom absolutely agree I do not use it correctly - I definitely do use it as a crutch because this is not my line of work, just something I picked up on the side but I absolutely love it and wish I had the time to understand how to use it properly. The documents I have created have been so well received within my firm. Things like being able to combine 4 forms into one using layers and customise submissions to various departments has been awesome, but I have definitely come to rely on those specific error messages to help me work out where I messed up.
@try67 - also couldn't agree more - there is zero information in that kind of error message - and I am guessing that is not going to change anytime. I know where that particular error is - more for example purposes - but with my situation and lack of knowledge here its kind of a deal breaker. Might need to get them to roll me back to 9 because I absolutely rely on the built in functions and this is a 20 page application form with a data collection section at the top which then populates the rest so there is LOADS of stuff in it.
Anyway, thanks to you both - appreciate you taking the time to get back to me. I can now stop trawling the internet for a solution I shall not find!!!
What I don't understand is why the step backwards in functionality? In previous versions (up to XI, I believe) the error message does include the name of the erroneous field, so why remove it and replace with a cryptic ellipsis? Absolutely mind-boggling.
100% agree!!! I am so disappointed - I love the interface and layout of this update, it's beautiful and clean and I have even worked out the baffling custom tool setup - but this kills it 100% for a novice like me Not that I know anything about this stuff, really, but I can't see the benefit in removing helpful information...
Sorry to be painful and I promise not to be asking you about every error message I get from this point on, but I have changed the setting on the console to "Enable after startup" and every now and then I get some glimmer of a field reference. One thing I am seeing constantly though, with every single move I make is this message:
2:Field:CalculateException in line 2 of function top_level, script Field:Calculate
The actions I am executing seems to have the desired result, so I figure its picking this up from some other part of the document.
I am just wondering if you can explain this "function top_level" to me. If its too hard to explain given I am a total learner, then I totally understand and no need to worry. I thought given I am see it so often I thought if I could understand what that is telling me it might help....
Thank you so much in advance if you can help!!
I think it just means code that's not inside a function, ie at the "top level" of the stack.