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

Top script (exempt) does not work but is based on bottom script which works fine? I need help.

New Here ,
Feb 27, 2020 Feb 27, 2020

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;

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms

Views

1.1K

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

LEGEND , Feb 27, 2020 Feb 27, 2020

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.

Votes

Translate

Translate
LEGEND ,
Feb 27, 2020 Feb 27, 2020

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. 

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 ,
Feb 27, 2020 Feb 27, 2020

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" ?????

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
LEGEND ,
Feb 27, 2020 Feb 27, 2020

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.

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 ,
Feb 27, 2020 Feb 27, 2020

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....

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
LEGEND ,
Feb 27, 2020 Feb 27, 2020

Copy link to clipboard

Copied

Not curly braces. Curly quotes. 

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 ,
Feb 28, 2020 Feb 28, 2020

Copy link to clipboard

Copied

For example: “exempt5”

It should be: "exempt5"

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 ,
Feb 28, 2020 Feb 28, 2020

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?

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 ,
Feb 28, 2020 Feb 28, 2020

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.

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 ,
Feb 28, 2020 Feb 28, 2020

Copy link to clipboard

Copied

Yeah, Word is a very bad tool for writing code. If you're on Windows I recommend using Notepad++.

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 ,
Mar 01, 2020 Mar 01, 2020

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?

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 ,
Mar 01, 2020 Mar 01, 2020

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.

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 ,
Mar 01, 2020 Mar 01, 2020

Copy link to clipboard

Copied

Thanks. I'll give Adobe a try.

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 ,
Mar 01, 2020 Mar 01, 2020

Copy link to clipboard

Copied

LATEST

Sorry, I ment to say Norton.

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