Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
That helps but I was hoping to get some code to paste into a javascript action.
Copy link to clipboard
Copied
There's example code that demonstrates how to do what I've described under the documentation of the numFields property of the Document object.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
No way to check the box?
Copy link to clipboard
Copied
There's no way to "un-check" it, ie cancel the character limit.
Copy link to clipboard
Copied
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){}
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now