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

How can I bulk change text field properties?

New Here ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

After using auto detect fields to create a form, I'm often getting text fields with inconsistent properties. I'm hoping there is a way to bulk update them, specifically to set these properties:

Font = Helvetica

Check spelling = true

Multi-line = true

Scroll long text = true

Comb = false

 

I've always struggled with JavaScript, but my coworker was able to write a script to bulk change all checkbox fields to use a ✔ symbol (below). Unfortunetly neither of us can work out how to get a script working for the text field properties I need.

/* Checkbox all have tick symbol*/
for (var i=0; i<this.numFields; i++){
var cBox = this.getNthFieldName(i);
if(this.getField(cBox).type == "checkbox"){
this.getField(cBox).style = style.ch;}}

Any help would be appreciated!

TOPICS
How to , JavaScript , PDF forms

Views

312

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

correct answers 1 Correct answer

Enthusiast , Aug 26, 2024 Aug 26, 2024

If you open the properties of a field you will notice that combination is grey out if you have any of the following checked:

Check Spelling, Multi-line, or Scroll long text

Therefore, if any of these are checked you can't change the combination property.  A script will generate the "set not possible" error.  The solution is to first uncheck these in the script, set the comb property to false, check them again.

 

Try this:

 

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=t

...

Votes

Translate

Translate
Enthusiast ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

 

 

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=this.getField(txt);
if(f.type == "text")
{
f.doNotScroll = false;
f.textFont = "Helvetica";
f.doNotSpellCheck = false;
f.comb = false;
f.multiline=true;
}}

 

 

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
New Here ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

I appreciate your help, but I can't get this to work. I'm not sure if I'm doing something wrong on my end, but even after running this code I have text fields with comb and Courier font properties (and no scroll, multiline or spell check because comb greys those out).
If it's relevant, I'm adding this code to an 'Execute JavaScript' step in a custom Action Wizard. I have no problems getting the checkbox code to work this way. I've put both codes as seperate 'Execute JavaScript' steps so they don't get caught up.

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 ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

Check the JavaScript console for errors.

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
New Here ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

Thank you, I should have thought of that. It's coming up with an error I'm not sure how to resolve:

InvalidSetError: Set not possible, invalid or unknown.
Field.comb:9:Console undefined:Exec

undefined

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
Enthusiast ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

The ability to set the comb property is dependent on the settings of multiple other properties in the options tab.  Move the comb property setting to the top of the list like this:

 

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=this.getField(txt);
if(f.type == "text")
{
f.comb = false;
f.doNotScroll = false;
f.textFont = "Helvetica";
f.doNotSpellCheck = false;
f.multiline=true;
}}

 

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
New Here ,
Aug 25, 2024 Aug 25, 2024

Copy link to clipboard

Copied

Coming up with basically the same error unfortunately

InvalidSetError: Set not possible, invalid or unknown.
Field.comb:6:Console undefined:Exec

undefined

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
New Here ,
Aug 25, 2024 Aug 25, 2024

Copy link to clipboard

Copied

I've just tried the comb property only to see if that got me anywhere, but no luck.

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=this.getField(txt);
if(f.type == "text")
{
f.comb = false;
}}
InvalidSetError: Set not possible, invalid or unknown.
Field.comb:6:Console undefined:Exec

undefined

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
Enthusiast ,
Aug 25, 2024 Aug 25, 2024

Copy link to clipboard

Copied

Try this:

 

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=this.getField(txt);
if(f.type == "text")
{
f.charLimit=0;
f.comb = false;
}}

If that doesn't work can you post your form?

 

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
New Here ,
Aug 25, 2024 Aug 25, 2024

Copy link to clipboard

Copied

Thanks again. Still has the same error.

InvalidSetError: Set not possible, invalid or unknown.
Field.comb:7:Console undefined:Exec

undefined

 I'll drop in the form. You can see the final row on the first page and all the rows on the second page are stuck as comb. (Obviously I'll need to manually create new text input for the cells that are considered part of the comb input, but I'm hoping to minimise the amount of manual work because I've got a lot of these!)

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
Enthusiast ,
Aug 26, 2024 Aug 26, 2024

Copy link to clipboard

Copied

If you open the properties of a field you will notice that combination is grey out if you have any of the following checked:

Check Spelling, Multi-line, or Scroll long text

Therefore, if any of these are checked you can't change the combination property.  A script will generate the "set not possible" error.  The solution is to first uncheck these in the script, set the comb property to false, check them again.

 

Try this:

 

for (var i=0; i<this.numFields; i++){
var txt = this.getNthFieldName(i);
var f=this.getField(txt);
if(f.type == "text")
{
f.textFont="Helvetica";
f.doNotSpellCheck=true;
f.multiline=false;
f.doNotScroll=true;
f.comb=false;
f.doNotSpellCheck = false;
f.multiline=true;
f.doNotScroll=false;
}}

 

Notice that Spell Check and Scroll are negatives in the script (false means the box is check, true means the box is not checked)

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
New Here ,
Aug 26, 2024 Aug 26, 2024

Copy link to clipboard

Copied

LATEST

Thank you so much, it works! I never would have thought of 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