• Global community
• Language:
• Deutsch
• English
• EspaÃ±ol
• FranÃ§ais
• PortuguÃªs
• æ—¥æœ¬èªžã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
Dedicated community for Japanese speakers
• í•œêµ­ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Exit
• Need java script for calculating two fields of a S...

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

New Here ,
Jun 26, 2019 Jun 26, 2019

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

859

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
9 Replies 9
Community Expert ,
Jun 26, 2019 Jun 26, 2019

Copied

What are the actual values of the fields?

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jun 26, 2019 Jun 26, 2019

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'

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

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

?

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jun 26, 2019 Jun 26, 2019

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

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

Copied

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

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jun 27, 2019 Jun 27, 2019

Copied

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

Copied

You still didn't answer my question.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jun 27, 2019 Jun 27, 2019

Copied

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

Copied

LATEST

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