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

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

New Here ,
Jun 26, 2019 Jun 26, 2019

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

What are the actual values of the fields?

Translate
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

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'

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

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

?

Translate
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

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

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

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

Translate
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

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

You still didn't answer my question.

Translate
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

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

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

Translate
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