2 Replies Latest reply on Mar 25, 2015 12:17 PM by gkaiseril

    Can i see all the javascript in my form?

    Sean.twyman Level 1

      Is there a way for me to see all the JavaScript in my form? I have several location throughout the form that has format JavaScript or validation JavaScript or calculation JavaScript. Is there a way i can pull all the JavaScript into one window so that i can compare it all. I don't need to change it i just want to see it all together. I am using adobe acrobat 9 standard but i can upgrade or change if needed.

        • 1. Re: Can i see all the javascript in my form?
          try67 MVP & Adobe Community Professional

          I think this option is only available in Acrobat Pro.

          • 2. Re: Can i see all the javascript in my form?
            gkaiseril MVP & Adobe Community Professional

            Only the Professional version lets one access the document level JavaScript and all JavaScripts. Bu since you can see the function that performs the formatting or calculation, you should be able to list them in your JavaScript console by just entering the name of the function without and parenthesis.

             

            So if there is validation script like:

             

            AFNumber_Format(2, 0, 0, 0, "", "$", true);

            one would enter the following line in the JavaScript console, highlight the line and press the Ctrl +  Enter key

             

            AFNumber_Format

             

            and obtain the uncommented script like:

             

            function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend) {

                var value = AFMakeNumber(event.value);

                var sign = value < 0 ? -1 : 1;

                var f = event.target;

                var formatStr = "";

                if (value == null) {

                    event.value = "";

                    return;

                }

                if (negStyle == 1 || negStyle == 3) {

                    if (sign > 0) {

                        f.textColor = color.black;

                    } else {

                        f.textColor = color.red;

                    }

                }

                value = new String(util.printf("%," + sepStyle + "." + nDec + "f", value));

                if ((negStyle != 0 || bCurrencyPrepend) && value.substring(0, 1) == "-") {

                    value = value.substring(1);

                }

                if (sign < 0 && bCurrencyPrepend && negStyle == 0) {

                    formatStr = "-";

                }

                if ((negStyle == 2 || negStyle == 3) && sign < 0) {

                    formatStr = formatStr + "(";

                }

                if (bCurrencyPrepend) {

                    formatStr = formatStr + strCurrency;

                }

                formatStr = formatStr + value;

                if (!bCurrencyPrepend) {

                    formatStr = formatStr + strCurrency;

                }

                if ((negStyle == 2 || negStyle == 3) && sign < 0) {

                    formatStr = formatStr + ")";

                }

                event.value = formatStr;

            }