Copy link to clipboard
Copied
var fieldNames = ["exempt1", "exempt2", "exempt3", "exempt4", “exempt5”, “exempt6”, “exempt7”, “exempt8”, “exempt9”, “exempt10”, “exempt11”, “exempt12”, “exempt13”, “exempt14”, “exempt15”, “exempt16”, “exempt17”, “exempt18”, “exempt19”]; // 50 year+ members
var Xmt = 0; for (var i in fieldNames) {
var f = this.getField(fieldNames[i]);
if (f.valueAsString!="") Xmt ++;}
event.value = Xmt;
var fieldNames = ["Plural1", "Plural2", "Plural3", "Plural4"]; //These members are in >1 organization
var Psum = 0; for (var i in fieldNames) {
var f = this.getField(fieldNames[i]);
if (f.valueAsString!="") Psum ++;}
event.value = Psum;
It probably has to do with the curly quotes you're using in the strings that are elements of the array. The first four elements use the correct quotes, but the others don't. So you just need to change them.
Copy link to clipboard
Copied
please explain “does not work” - what you expect, and what you get. Also any messages from the JavaScript console. Also, where do you place these two scripts exactly? Please be detailed and precise.
Copy link to clipboard
Copied
Here's what I should have said. There are 19 variables that are strings, member names, declared as "exempt1" through "exempt19". Xmt is set to zero in preparation for counting fields 1 - 19 which are strings and any one or more of the 19 fields are not blank.The total counted is returned through value xmt. While I don't think it should make any difference at all, the "xmt" value is returned from page 3 of the form to a page 1 field for further calculations. I included the shorter script that evaluates four fields on page 3 and correctly returns a value of either 1, 2, 3, or 4 to page 1 at which time I plan on doing simple math like +, -, and x.
Thanking you in advance for your time and talent. My previous replys crash with the notation "not authenticated" ?????
Copy link to clipboard
Copied
It probably has to do with the curly quotes you're using in the strings that are elements of the array. The first four elements use the correct quotes, but the others don't. So you just need to change them.
Copy link to clipboard
Copied
Thank you for the feedback. I looked the script over and over again and can only find two curley braces one before the counter and the other immediately after the counter. I am baffled that the script with up to 19 strings does not return anything while the shorter script workes fine. Thank you for your help, time and talent....
Copy link to clipboard
Copied
Not curly braces. Curly quotes.
Copy link to clipboard
Copied
For example: “exempt5”
It should be: "exempt5"
Copy link to clipboard
Copied
How do you do that!? I only have one set of quotes on my kbd. Are you going direct to ASCII?
Copy link to clipboard
Copied
OMG you're right. FYI script was created in word and copied over to Adobe. I reworked the script in a txt document and it all came together as planned. Nice catch...Thank you.
Copy link to clipboard
Copied
Yeah, Word is a very bad tool for writing code. If you're on Windows I recommend using Notepad++.
Copy link to clipboard
Copied
Your keen catch has made me a happy camper. My forms are finished now but when I go to publish it Norton removes the scripts that make the forms work. Even if I disable Norton locally my users will most likely experience the sametype problem. Can you help me to publish this labor of love?
Copy link to clipboard
Copied
I don't see what I can do to help you. Most normal AV applications will not remove scripts from a PDF file.
You need to contact Norton and ask them for a solution.
Copy link to clipboard
Copied
Thanks. I'll give Adobe a try.
Copy link to clipboard
Copied
Sorry, I ment to say Norton.