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

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

740

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

Copy link to clipboard

Copied

What are the actual values of the fields?

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 ,
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'

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 ,
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

?

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 ,
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

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 ,
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?

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

Copy link to clipboard

Copied

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

Copy link to clipboard

Copied

You still didn't answer my question.

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

Copy link to clipboard

Copied

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 ,
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.

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