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

Copy Field Contents to another field with if statement.

New Here ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

I have a Button that on click populates a Package one of the the JS that I am using is causing me headaches though.

I have an if statement that checks if a radio button value then depending on the value is supposed to copy the value of a hidden field containing multiple lines of text to another field.  Unfortunately the button click sets the value of the Field to object Field.

if (this.getField("Pac.Comp").value == "DMV") {

this.getField("Form.PG5Remarks2").value = this.getField("PG5StatementFem").value};

Form.PG5Remarks  has the "object Field" instead of the statement.

Thanks for any assistance.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

537

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

What does you get when you execute following in the console?

this.getField("PG5StatementFem").value;

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

I am not using a console.  And don't have the permissions to install one.

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

There's nothing to install. It's a built-in feature of Acrobat. Press Ctrl+J to open it.

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

It's pretty much impossible to fix JavaScript code without looking in the console, because that's where all the error messages come.

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

If you do not want to use the built-in console, then you need to add more JavaScript code to display the massage. JavaScript includes the "try { ....} catch (error) {...} " statements to trap and handle error exceptions. Other things you could try include using the "open consonle();" statdement in your script or changing your copy of Acrobat's Preference to open the console on error.

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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

It's:

console.open();

Not:

open 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 ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

LATEST

Sorry, it's actually:

console.show();

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