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

two codes

Enthusiast ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

Can someone pls help.

event.value = Number(this.getField("num1").valueAsString)*7 + "%";
event.value = Number(this.getField("num2").valueAsString)*7 + "%";

Only the second code is working but I need both of them to work,if value is changed in "num1" field I need first code to activate and if value is changed in "num2" field I need second code to activate.

TOPICS
Acrobat SDK and JavaScript

Views

275

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 ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

You mean, you want a change in num1 to cause it to completely ignore num2, unless someone later changes num2, in which case it will ignore num1? That's very unusual and certainly can't be done from a calculation field. You'd need to trigger actions as num1 and num2 are changed.

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
Enthusiast ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

num1 and num 2 is not important I just wanna know if it's possible for both codes to work their job at the same time and how to make it do that?

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 ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

The second line will overwrite the result of the first one. In order to do what you describe you need to move your code to the validation scripts of the "num1" and "num2" 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
Enthusiast ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

That wouldn't work.I have 2 buttons,but1 activate num1 and but2 activate num 2 and result from num1 and num 2 is showed in textfield (t1) but they can't overwrite one another they need to add to same field,(example: but1 activate num1 which add 4 to t1 but2 activate num2 which also add 4 to t1 which now show 8.thats why I need both of the codes to work at same time cuz I use that code on t1 field as custom validation.

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
Enthusiast ,
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

LATEST

Thx guys for help I figure it out with this code that was lucky guess cuz I don't know anything about coding.

event.value = Number(this.getField("num1").valueAsString)*7 + Number(this.getField("num2").valueAsString)*11;

 

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