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

Acrobat form javascript combo not working

New Here ,
Oct 31, 2017 Oct 31, 2017

Copy link to clipboard

Copied

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

Views

694

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

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.

Votes

Translate

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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;

        }

    }

}

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

You can run it from the JS Console.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

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>

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

Copy link to clipboard

Copied

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!

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

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.

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