Need java script for calculating two fields of a Special Arbitrary Format to a Number field

New Here ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

I converted an excel sheet to a Form but I need help with Formatting and Calculating with JavaScript.

Need javascript for calculating two fields of a Special Arbitrary Format to a Number field.

[Text1] "004+00" - [Text2] "010+50" = [Text3] "650"

TOPICS
Acrobat SDK and JavaScript, Windows

Views

160

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 ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

What are the actual values of the fields?

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 ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

004+00 - 010+50 = 650

These are references on some engineering alignment sheets that measure distance.

004+00 is 400'

010+50 is 1050'

650 is 650'

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 ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

The Format setting influences what the value of the field looks like, not its actual value.

What does this line of code produce when the value of Text1 is "004+00":

this.getField("Text1").valueAsString

?

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 ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

When I put in this javascript:

event.value = Math.abs(this.getField("Text2").value -

this.getField("Text1").value);

it gives me a error of "The value entered does not match the format of the field [Text3]

Under the format tab

Text1 and Text2 are -Special-Arbitrary Mask-9999+99

Text3 is -Number

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 ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

You didn't answer my question. What is the output of the code I gave you?

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 ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

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 ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

You still didn't answer my question.

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 ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

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 ,
Jun 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

LATEST

Run this code from the JS Console window and let us know what the output is.

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