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

78

Likes

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
Adobe Community Professional ,
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;

Likes

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.

Likes

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
Adobe Community Professional ,
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.

Likes

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.

Likes

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.

Likes

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

Copy link to clipboard

Copied

It's:

console.open();

Not:

open console();

Likes

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

Copy link to clipboard

Copied

LATEST

Sorry, it's actually:

console.show();

Likes

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