JavaScript - Value updates just at second change

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

112

Likes

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

Copy link to clipboard

Copied

Change the field calculation order. 

Likes

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

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

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 ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

quote

Change the field calculation order. 


By @Bernd Alheit

 

And what we should do when the fields are not calculating fields, but input text fields?
I mean, they don´t show up when i open the calculating order menu.

Likes

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 ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

You can only change the order of fields with calculations.

The order is only important for fields with calculations. 

Likes

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 ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

I am having an issue.
I have setted up some javascripting for my form.

One of them populate a textfield2 from a dropdown1, and the dropdown1 have a document javascript setting with the data it should fill the textfield2.
I order to input the correct data, the script must get information from textfield3 (another field) to calculate the correct number.
The issue: if i change the input in textfield3, it won´t update the previous calculation.
Can you help manage that?

Likes

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 ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

What calculations does you use? 

Likes

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 ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

LATEST

I was trying to populate a calculation made by a dropdown javascript input, but I did a workaround it and made it send the data to a hidden field, than I scripted the calculating in the final field, with calculation, and it worked.
I have another question...
is that possible to make javascript understant the * (all) symbol?
For example: I have several entries that I use as data. For several of them, there are the same prefix.

Doc (int)

Resume (int)

Hospital (con)

Health (con)

They are all option of the dropdown menu, is that possible to assign the value of a field to all option that has (int), for example, without type them all in the data info?

Likes

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