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

Need a form field (lines verified) to return a value.

New Here ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

I need a field (lines verified), to show if there is data in a group of other fields. i.e 5 fields, only three have data. I need the lines verified field to show 3.

Hope I explained somewhat

Yes, I am new to scripting

TIA

TOPICS
JavaScript

Views

228

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

Community Expert , Jul 12, 2022 Jul 12, 2022

You can use this code as the custom calculation script of the "lines verified" field to do it (just adjust the field names in the first line):

 

var fields = ["Text1", "Text2", "Text3"];
var totalFilled = 0;
for (var i in fields) {
	if (this.getField(fields[i]).valueAsString!="") totalFilled++;
}
event.value = totalFilled;

Votes

Translate

Translate
Adobe Employee ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Hi Alan

 

Hope you are doing well and thanks for reaching out.

 

The workflow you are trying to achieve is possible using JavaScript. For more information please check the help pages listed below:

https://acrobatusers.com/tutorials/javascript_console/

https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

 

Hope it will help

 

Regards

Amal

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 ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

You need to be specific about what exactly do you mean by verified.

 

Are you trying to perform anarithmetic calculation that shows the total in another field ? (for example)

 

If yes, you can use the built-in calculating features or employ a JavaScript script.

 

Otherwise, please describe in more detail what type of values are contained in those text fields (i.e. names, numbers, fractions, decimals)

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Hello and thanks.

This document is like an invoice; a list of 10 items each with a field for quantities. On the invoice there is a field that needs to verify if there is a quntity in any or all of the quantity fields, not a sum only if there is an entry.

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

You can use this code as the custom calculation script of the "lines verified" field to do it (just adjust the field names in the first line):

 

var fields = ["Text1", "Text2", "Text3"];
var totalFilled = 0;
for (var i in fields) {
	if (this.getField(fields[i]).valueAsString!="") totalFilled++;
}
event.value = totalFilled;

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 ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

LATEST

Hi ,

Thanks for the sript.

I really need to learn this.

Thanks again I appreciate 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