1 person found this helpful
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.
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.
and execute it by pressing Ctrl + Enter
It should return 1.
And if that checks out, add this line of code just before the one that generates the error:
The String object's indexOf method, yes, but not that of an Array...
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!
Is there any chance that whatever "Item" was set to changed?