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!
Copy link to clipboard
Copied
See if this works for you Website-effectiviteitstest-10-11-2020
Copy link to clipboard
Copied
Change the field name in the script.
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.
-
Copy link to clipboard
Copied
Check the Javascript console (ctrl-j) for errors.
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
Acrobate du PDF, InDesigner et Photoshopographe
Copy link to clipboard
Copied
See if this works for you Website-effectiviteitstest-10-11-2020
Copy link to clipboard
Copied
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!!

