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

Help asked with form script

Explorer ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

Hi,

A year ago I received help from someone on this forum and the form works well.  Now I needed to do some adjustments to the source file (Indesign) and I made a new pdf with text field properties. I checked with the old pdf and put in the same properties into the new pdf. But the calculation is not happening. 

 

What needs to happen is this: it's a form with yes (ja) or no (nee) answers. The 'ja' answers need to be counted and need to be displayed in the last line were it says: 'Totaal'. I copied the code from the old pdf into the new one and changed the text field id numbers. However the count is not happening. What is going wrong? I uploaded the file so you can take a look.

Many thanks in advance!

TOPICS
PDF forms

Views

622

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 , Nov 12, 2020 Nov 12, 2020

See if this works for you Website-effectiviteitstest-10-11-2020 

Votes

Translate

Translate
Community Expert ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

Change the field name in the script.

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
Explorer ,
Nov 12, 2020 Nov 12, 2020

Copy link to clipboard

Copied

Hi Bernd,

Thanks for your repy. I saw that i uploaded a file with the old field id names, is that what you mean? I changed the script to the current id names, but still the form doesn't work.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-

 

 

 

 

 

 

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 ,
Nov 12, 2020 Nov 12, 2020

Copy link to clipboard

Copied

Check the Javascript console (ctrl-j) 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
Community Expert ,
Nov 12, 2020 Nov 12, 2020

Copy link to clipboard

Copied

Replace:

// Initialize counter variable
var sum = 0;
// Loop through the fields
for (var i = 1; i <= 38; i += 1) {
// Add one if Tekstveld is set to ja
if (getField("Tekstveld " + i).valueAsString.toLowerCase()=="ja") {sum += 1;}
}
// Set this field's value to the sum
event.value = sum;

 

 

By:

// Initialize counter variable
var sum = 0;
// Loop through the fields
for (var i = 39; i < 76; i += 1) {
// Add one if Tekstveld is set to ja
if (getField("Text Field " + i).valueAsString.toLowerCase()=="ja") {sum += 1;}
}
// Set this field's value to the sum
event.value = sum;

 

Beware of blank spaces in the field name

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 ,
Nov 12, 2020 Nov 12, 2020

Copy link to clipboard

Copied

See if this works for you Website-effectiviteitstest-10-11-2020 

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
Explorer ,
Nov 12, 2020 Nov 12, 2020

Copy link to clipboard

Copied

LATEST

Ah, I see now what Bernd meant with the Text field name. Yes, this works. I switched Adobe versions and now I'm working with a Dutch version. Thank you!!

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