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

Acrobat form javascript combo not working

New Here ,
Oct 31, 2017 Oct 31, 2017

I am working on a form that contains a drop down box (titled Rep) for the user to choose their rep from.  When the rep is chosen, another field (titled RepEmail) is supposed to populate with the appropriate email address.

When you press submit, the form will be emailed as a PDF attachment to the email address that generated.

I have had this work on two occasions.  The first time it worked the first three times I tried it.  When attempting to show someone how it will work, it didn't do anything.

I reworked every field and calculation again and it worked.  This time I was able to choose different names in the drop down and the email changed appropriately.  I pressed submit form and it popped up the email with the right email address and attachment.

I attempted to show someone... and it stopped.

You can choose a name in the drop down, but nothing generates anywhere else.

I know the JavaScripts are right since they did work once... why would they stop?

I have the cloud Adobe... the latest updates, etc.  Minimal experience with this stuff...

HELP.

TOPICS
Acrobat SDK and JavaScript , Windows
1.2K
Translate
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 , Oct 31, 2017 Oct 31, 2017

There are multiple errors in your code. Change the value of any field and then check the JS-Console.

Translate
Community Expert ,
Oct 31, 2017 Oct 31, 2017

In what application are you opening the file? Are you opening it inside a browser window?

Translate
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 ,
Oct 31, 2017 Oct 31, 2017

Adobe Acrobat is the program being used.  Not in a browser window.

Translate
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 ,
Oct 31, 2017 Oct 31, 2017

Very strange... Check the JS-Console (Ctrl+J) for error messages.

If you can, share the file (via Dropbox, Google Drive, etc.) and I'll take a look at it and will let you know if I see anything that's problematic.

Translate
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 ,
Oct 31, 2017 Oct 31, 2017

I don't see any errors, however - I'm very new to this... maybe it being blank is not a good thing?  Here is a link to the file. Quality Report Card_blank.pdf - Google Drive

Translate
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 ,
Oct 31, 2017 Oct 31, 2017

There are multiple errors in your code. Change the value of any field and then check the JS-Console.

Translate
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 ,
Nov 01, 2017 Nov 01, 2017

i did that and in the bottom box it says "1051:byteCodeTool"  What does that mean?  error1.JPG - Google Drive

Translate
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 ,
Nov 01, 2017 Nov 01, 2017

when i cleared the form and just changed the rep name, CTRL+ J, I received many of the "f is null"... https://drive.google.com/open?id=0B8XS-cXQSVGfUWNSYUgzVnhacXc

Translate
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 01, 2017 Nov 01, 2017

Right, because you're trying to access f before defining it... Use this code:

for (var i = 0; i < numFields; i++) {

    var fName = this.getNthFieldName(i);

    var f = this.getField(fName);

    if (f.type === "text") {

        var fvalue = f.valueAsString;

        f.alignment = "left";

        f.textSize = 10;

        f.textFont = "Arial";

        f.textColor = ["RGB",0/255,96/255,127/255];

        if (fvalue.length>0) {

            f.charLimit = fvalue.length;

            f.comb = true;

            f.value = "";

            f.value = fvalue;

        }

    }

}

Translate
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 ,
Nov 01, 2017 Nov 01, 2017

where do i put that?  Do i change any of it, or is it custom to fit my form?  Sorry, I am brand new at this.

Translate
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 01, 2017 Nov 01, 2017

You can run it from the JS Console.

Translate
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 01, 2017 Nov 01, 2017

I used the code you posted and added the new feature to it. I had assumed you wrote it to match your needs...

Translate
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 ,
Nov 01, 2017 Nov 01, 2017

I googled the codes and adapted them to my needs, but being new, it has to be dumbed down for me.   The JS Console has several windows in it, so I wasn't sure where to put it.  This is the first time I've seen the window and don't have any codes in it except the errors.

Do I add your code to my actual java script on the action button of the field?

Translate
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 01, 2017 Nov 01, 2017

I'm assuming it's something you only need to run once. If that's the case,

there's no point in attaching it to a button, although you can do it.

You can read here about how to use the Console:

https://acrobatusers.com/tutorials/javascript_console

On Wed, Nov 1, 2017 at 6:55 PM, kathrynw30934429 <forums_noreply@adobe.com>

Translate
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 ,
Nov 01, 2017 Nov 01, 2017

I got it to work!  I see I still have errors, but the field generates appropriately and allows me to submit the form to the email address in that field as well as the other hard coded.  It says ReferenceError: cRep is not defined 5: Document-Level:SetFieldValues, and then goes on to say TypeError: f is null 1051:byteCodeTool - over and over like in the Shining. But it works.  Should I be worried?

PS - Thank you for your help and patience!

Translate
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 01, 2017 Nov 01, 2017

The "f is null" error means you have a script that refers to a field name

that doesn't actually exists. You should be worried if your calculations

are not working correctly, I would think.

Translate
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 ,
Nov 02, 2017 Nov 02, 2017

It looks like everything is working, but I have a long list of that f is null error... how do I know what it is referring to?

Translate
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 02, 2017 Nov 02, 2017
LATEST

Unfortunately, you don't. It's one of the problems with using the built-in calculation options: The error messaging for it is very bad.

Try to think if you renamed any fields after applying a calculation. If you did, that's most likely the culprit.

Translate
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