• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Javascript Tooltip clearing issue

Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

I have using the script below to clear a massive amount of tool tips and am getting a syntax error from the javascript debugger. Can someone let me know possibly why I am encountering this? I can't seem to get it to work on a test PDF with simply name fields as well. I know I gotten this to work before.

// Set all field tooltips to blank
for (var i = 0; i < numFields; i++) {
getField(getNthFieldName(i)).userName = "";
}

SyntaxError: syntax error

1:Console:Exec

undefined

Thank you

TOPICS
Acrobat SDK and JavaScript , Windows

Views

877

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

Works fine for me. Are you sure you're selecting the whole code when you're executing it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

Well I pasted the script above exactly so if that's what you validated, I am not sure why it doesn't work for me.

I merely place it in it in the javascript debugger > script and console

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

To execute more than one line in the JavaScript console, you have to select all of it. Take a look here for more information about how to use the console: https://acrobatusers.com/tutorials/javascript_console

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

I did read this page and will go over it again in detail, but when you reference "you have to select it all", what is it you are referring to?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

You have to select all of the code in the JavaScript console before you press Ctrl+Enter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

I did attempt this as well a few times, but during the process of selecting it all in the console (highlighted blue), I am unable to hit enter (keypad) if I do this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

Are you on a Mac? If so, things are a bit more complicated: Select the text and then use Opt-Cmd-Enter to execute it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

I am on Windows 7.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

What happens if you create a button and place the code in the Mouse up event, and then click the button?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

That worked. Does it matter what the field names are? This massive field attempting tooltip clearing (over 700 fields) have field names that consist of possible special characters.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

No. Using this method the field names shouldn't matter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

It is a good practice to include the "object" of the property or method you are trying to access or modify. All the properties and methods you are trying to use refer to the current opened and focused PDF, so I would add the "this." for the object;

Have you tried to add any debugging statements to print out the item being processed?

// Set all field tooltips to blank
console.show();console.clear();
console.println("number of fields: " + this.numFields);
for (var i = 0; i < numFields; i++) {
console.println(i + ": " + this.getNthFieldName(i) + " " + this.getField(this.getNthFieldName(i)).userName);
getField(getNthFieldName(i)).userName = "";
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

I did try the script provided with the same error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2016 Mar 15, 2016

Copy link to clipboard

Copied

LATEST

I ended up uninstalling acrobat to make sure it is now any settings/preferences that could trigger this hiccup, did that and redid the script and it worked. Thank you to everybody

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines