JavaScript - Value updates just at second change

Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hello,

i have a form with two radio-choice-options and two text fields.

Radio1: Name: uType   Option: uTypeOne Preselected

Radio2: Name: uType   Option: uTypeTwo

Text1: Name: qBase    Value = custom:

if (this.getField("uType").value == "uTypeOne") {
this.getField("qBase").value = 1;
} else { 
if (this.getField("uType").value == "uTypeTwo") {
this.getField("qBase").value = 0;
 }}

Text2: Name: tBase   Value = custom

this.getField("tBase").value = this.getField("qBase").value*40;

 

When i click the Option2 the Text1 changes to "0" but Text2 stay on 40.
When i check the Option1 again, Text1 changes back to "1" but THEN Text2 changes to 0.

Then Text2 works fine but opposite of the options. Option1 is then 0 and Option2 is 40.

 

Looks like Text2 is just able to get the last value instead of the current, how can i fix that?

Thank you very much in advance for your help

TOPICS
How to, JavaScript, PDF forms

Views

42

Likes

translate

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

correct answers 1 Correct Answer

Adobe Community Professional , Feb 25, 2021 Feb 25, 2021
Change the field calculation order. 

Likes

translate

Translate

Translate
Adobe Community Professional ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Change the field calculation order. 

Likes

translate

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 Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Thank you very much, i had so search for that setting but i found it.

 

So when i understood right the order is up first and down later?

Likes

translate

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 ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Correct 

Likes

translate

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