Skip to main content
Participating Frequently
January 6, 2017
Question

Javascript 1.6 stopped working, how to fix this?

  • January 6, 2017
  • 2 replies
  • 704 views

I have a PDF form with embedded Javascript that I made a while back. It's been working fine for months, but today it started giving me this error:

TypeError: Item.indexOf is not a function

I looked around the forum and found that this seems to be a problem with older Acrobat not supporting JS 1.6. But I'm using Acrobat 2015, which should support this call. And again, this script had been working fine until today.

I don't know if it's related, but the only factor I can think of is that I've downloaded and used a heavily JSed PDF. That PDF worked just fine, but would it be possible that this PDF somehow disabled my Acrobat's JS 1.6 support?

How do I get JS 1.6 support back?

This topic has been closed for replies.

2 replies

Participating Frequently
January 6, 2017

Hmm. Weird. The error just went away as mysteriously as it appeared. Didn't even reboot, reinstall or any of the standard magical fixes.

Thanks for all the help -- hope it doesn't come back again!

Inspiring
January 6, 2017

Is there any chance that whatever "Item" was set to changed?

Inspiring
January 6, 2017

What it "Item", exactly? This problem probably isn't related to what you're assuming. If you're using it with something that's supposed to be a string, I'd guess that it's not actually a string in this case. Same idea if it's supposed to be an array, but isn't.

A fairly common example of how this could happen is when you get the value of a text field using the value property. Most of the time it will be a string, but it could also be a number or a boolean. Since a number of boolean doesn't have an indexOf method, you'll get this error. The fix in cases like this is to get the field value as a string using the valueAsString field property.

Participating Frequently
January 6, 2017

Thanks for the answer, but there doesn't seem to be any problem with the script itself. I tested the exact same PDF on a different machine and it runs just fine. Also runs fine in Adobe Reader on the same machine.

And yes Item is indeed a string.

Inspiring
January 6, 2017

What happens when you open the interactive JavaScript console by pressing Ctrl + J and enter this line of code:

"ABCD".indexOf("B");

and execute it by pressing Ctrl + Enter

It should return 1.