Skip to main content
Known Participant
October 14, 2016
Question

Error in Acrobat JavaScript Console

  • October 14, 2016
  • 20 replies
  • 5458 views

Hi, i have adobe pro xi & foxit phantom 6 in my pc. if i run bellow code in foxit JavaScript Console, working perfectly but if run same code in Acrobat JavaScript Console, giving error. can u pls help me find out the issue ??. thanks..

for (var i = 0; i < numFields; i++) {

var f = getField(getNthFieldName(i));

f.comb = false;

f.charLimit = false;

f.doNotSpellCheck = false;

f.doNotScroll = false;

This topic has been closed for replies.

20 replies

omanbuxAuthor
Known Participant
October 15, 2016

hi, i have manage to work bellow code..

for (var i = 0; i < this.numFields; i++) {

var fNm = this.getNthFieldName(i);

var f = this.getField(fNm);

if (f.type == "text") {

f.doNotSpellCheck = false;

f.doNotScroll = false;

}

}

now i want add bellow two codes into same script.

f.comb = false;

f.charLimit = false;

my problem is if i add that two lines into above script, it's giving bellow error. pls help me. thanks..

RangeError: Invalid argument value.

Field.charLimit:15:Console undefined:Exec

false

Bernd Alheit
Community Expert
Community Expert
October 15, 2016

charLimit is an numerical value

omanbuxAuthor
Known Participant
October 15, 2016

hi, actually what i want to do is, in my PDF form any text field has bellow options selected then i want to remove that selection. can  u pls help me. thanks..

limit number of characters

comb of characters

Inspiring
October 14, 2016

Also, Phantom doesn't report errors like Acrobat does, so it very well didn't actually work there either.

Karl Heinz  Kremer
Community Expert
Community Expert
October 14, 2016

In that case, there is something else wrong. When I run your script (as typed, just with the "}" added at the end), I get the following when the script encounters a non-text field:

InvalidSetError: Set not possible, invalid or unknown.

Field.comb:3:Console undefined:Exec

You are getting a syntax error, which you should not based on your script.

Do you know how to execute a multi-line script in the console window? Take a look here for a tutorial about how to use the console and how to execute code: https://acrobatusers.com/tutorials/javascript_console

Inspiring
October 14, 2016

It would be helpful if you were to post the entire error message. Unfortunately JavaScript is an interpreted language and comes to a halt at the first error encountered. This means you will debugging one error at a time.

omanbuxAuthor
Known Participant
October 14, 2016

hi, i have add closing "}" & got bellow error. also my form has check boxes & radio buttons. thaks..

SyntaxError: syntax error

1:Console:Exec

undefined

Inspiring
October 14, 2016

You may need to share your form or an example with the same issue for others to diagnose the problem.

Do you have fields that are other than text fields? If so, then you need to exclude them from being processed by testing the "type" property.

Karl Heinz  Kremer
Community Expert
Community Expert
October 14, 2016

There is a closing "}" missing. If that's not the problem, then what exactly is the error message you are getting?

Karl Heinz  Kremer
Community Expert
Community Expert
October 14, 2016

One more thing: The properties you want to set would only be valid for text fields, so if you have any other field type in your document, then that is very likely the reason for the error message.

omanbuxAuthor
Known Participant
October 14, 2016

hi, i have add closing "}" & got bellow error. also my form has check boxes & radio buttons. thaks..

SyntaxError: syntax error

1:Console:Exec

undefined