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

Programmatically de-select Text Field Options

Community Beginner ,
Nov 21, 2016 Nov 21, 2016

How do Programmatically de-select the text field options for "Scroll Long Text" and "Check Spelling"?

These seem to be turned on by default and it drives me nuts. I need a way to de-select these two options for tens if not hundreds of fields at one go.

By the way, the suggestion to select all fields and deselect those two boxes is not gonna help. Been there, done that, expressed profanity.

TOPICS
Acrobat SDK and JavaScript , Windows
2.1K
Translate
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 ,
Nov 21, 2016 Nov 21, 2016

These properties are, respectively, doNotScroll and doNotSpellCheck. As you can see, they have a reverse nature, so if you want to disable the Scroll Long Text option you need to set doNotScroll as true. And the same for doNotSpellCheck...

You can use a for-loop to iterate over all of the fields in the file and set their properties. Make sure you check their type first, though, as these properties only apply to text fields, of course (well, doNotSpellCheck also applies to editable combo-boxes, to be precise).

Translate
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 Beginner ,
Nov 21, 2016 Nov 21, 2016

That helps but I was hoping to get some code to paste into a javascript action.

Translate
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 ,
Nov 21, 2016 Nov 21, 2016

There's example code that demonstrates how to do what I've described under the documentation of the numFields property of the Document object.

Translate
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 Beginner ,
Mar 04, 2017 Mar 04, 2017

Can you tell me the property name of the checkbox for Limit of ___ characters?

charLimit will set the number of characters to any whole number 1 or higher but I cannot set it to zero nor can I find a way to uncheck the checkbox. So far as I can tell the name of the checkbox is not documented.


Thank you.

Translate
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 04, 2017 Mar 04, 2017

That's a bug in Acrobat JS. You can't set it to "0" once it's set to something else.

Instead, just set it to a very high value, like 10000000...

Translate
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 Beginner ,
Mar 04, 2017 Mar 04, 2017

No way to check the box?

Translate
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 04, 2017 Mar 04, 2017

There's no way to "un-check" it, ie cancel the character limit.

Translate
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 Beginner ,
Mar 05, 2017 Mar 05, 2017

Solution below. By the way, the files are listed in the Acrobat Scripting Guide.

var x = event.target.doc;

// Count the number of fields in the document

// console.println(x.numFields);

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

   var n = x.getNthFieldName(i);

   console.println('Field(' + i + ') = ' + n);

   var f = getField(n);

      try{

      console.println('Field value = ' + f.alignment);

}

      catch(InvalidGetError){}

   // First, get rid of Adobe's stupid default tooltip

   f.userName = "";

   // Next, clear some settings on the Options tab

   try{

   f.alignment = "left";

   }

   catch(InvalidSetError){}

   try{

   f.doNotScroll = true;

   }

   catch(InvalidSetError){}

//   The property name of character limit check box is not documented and apparently cannot be set.

//   Once charLimit is set to anything it cannot be re-set to 0 or removed.

//   If charLimit has been set the only apparent solution to "unset" it is to change it to a really high value.

//   try{

//   f.charLimit = 0;

//   }

//   catch(InvalidSetError){}

   try{

   f.comb = false;

   }

   catch(InvalidSetError){}

   try{

   f.doNotSpellCheck = true;

   }

   catch(InvalidSetError){}

}

Translate
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 05, 2017 Mar 05, 2017

I need to do this programmatically, not manually and not field-by-field.

My answer was "manually" and "file by file" (not field by field), but you kick my ass.

I will re-use your script for sure.

Thank you for sharing.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 Beginner ,
Mar 11, 2017 Mar 11, 2017
LATEST

Thank you but it's not my script. It was written by a friend whom NO ONE would ever believe has this capability, as he is retired and also just doesn't talk about himself that way. He's told me he has an improvement which I will post if/when he gives it to me.

It occurs to me that the problems I am encountering may be the result of having both Acrobat 7 Pro and Acrobat 10 Pro on the same system.

Translate
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 ,
Nov 22, 2016 Nov 22, 2016

These seem to be turned on by default and it drives me nuts.

Turn off these 2 options in one field, then right-clic upon this field and choose : Use current properties as new defaults

By the way, the suggestion to select all fields and deselect those two boxes is not gonna help

Why ? It is, however, the simplest method


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 Beginner ,
Nov 22, 2016 Nov 22, 2016

Use current properties as new defaults only works for manually-created fields. It doesn't work for those created automatically.

The suggestion to select all fields and deselect those to boxes may be simple but it doesn't work. First, you have to make sure not to select radiobuttons or checkboxes or other non-text fields, and second, even if your form has only text fields, it doesn't work. Even a font change won't work although I've learned that it did work for me once when I made sure to select only fields that had all the same font.

Translate
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 ,
Nov 22, 2016 Nov 22, 2016

First, you have to make sure not to select radiobuttons or checkboxes or other non-text fields,

You can select fields in the "Prepare form" pane, where you can sort them by tab order or by alphabetical order.

and second, even if your form has only text fields, it doesn't work

It works fine for me since years.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 Beginner ,
Nov 29, 2016 Nov 29, 2016

Can anyone help with the original question? I need to do this programmatically, not manually and not field-by-field. Code that can be attached to a button would be fine if the field names can remain undefined. I'm not a programmer or code writer except in the most rudimentary sense and am just looking for help solving this problem.

Translate
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