Help! with Javascript in a pdf form

Hi! guys, I have a question about Javascript programming for pdf forms.

I currently use the Adobe Pro DC, and I need to know how can I do 2 things:

1º I need to know how to make that an ACTIVATE Check Box149 subtract 2 from the result of Text99 (in turn Text99 is obtained from Text88 * 2) … Basically what I want is that the Text99 value variable, every time you activate a Check Box149, 150, 151, etc … will be subtracted 2 to the Text99.

2º The other question will come to see how we could do for the value of the Max box. 50 lb., will change the font to RED, if the value of the box is greater than 50, that is, Max 50 lb.> 50 then change to RED color.

I have partially managed to come up with the “solution” for the 1st option but something is wrong …

Basically when I enter a number in the Text88 box (example 10) it appears in Text99 20OffOffOffOffOffOff … (if I activate each Check Box149, 150, 151 … the Off set is removed and it is deducted 2). How could I make the Off disappear … I guess it should be putting true / false, check/cheked code with the checkBox.

Thanks, to see if anyone knows how I can solve the issue and help me complete or correct the code.

Here is the actual code that i wrote:

if (this.getField(“Text88”).value !== this.getField(“Text99”).defaultValue) {

event.value = this.getField(“Text88”).value * 2.0 + this.getField(“Check Box149”).value + this.getField(“Check Box150”).value + this.getField(“Check Box151”).value + this.getField(“Check Box152”).value + this.getField(“Check Box153”).value + this.getField(“Check Box153”).value + this.getField(“Check Box154”).value + this.getField(“Check Box155”).value + this.getField(“Check Box156”).value + this.getField(“Check Box157”).value + this.getField(“Check Box158”).value;

} else {

event.value = event.target.defaultValue;

}

Thank you.

Does anyone have an idea? I searched the internet, youtube, and I do not give with the key

Thx

Your questions are too confusing.

1 Like

I have a Pdf form. It has a field named “Text99”. When i put a value in other square named “Text88”, this value multiplied by 2 is appeared in Text99. This I have managed to do.

Ok, up there all right

On the other hand, i have various Check Box which I can mark or unmark with an X. For example Check Box149 is one of them…

What I want is simple in theory…i want that every time you mark a Check Box, it subtract the value 2 from the “Text99” field, and when you unmark it, nothing is applied.

The difficulty comes in that it is a multiple operation … and i need to use javascript.

The calculatios of Text99 must be equal to Text88 (value)*2-Check Box149 (value=2) (checked)-Check Box150 (value=2)(checked)-Check Box151…etc… If i put for example the number 10 on Text88…it should appear 20 in Text99… and when i check/mark a Check Box… subtract 2 to this value… 18, 16, 14… etc… if the Check Box is unmarked the value is 0.

With the above code, I have obtained the operations I want, but some code is missing to complete when the check box is unchecked … because if they are disabled, an error appears, when they are activated, the error disappears.

2º The other question is more simple… i have a field named “Max box. 50 lb.”… the value that appears in this field is the sum of various fields… ok no problem with this… but i want that when the value of this field is 51 or higher… the font changes to RED color.

thx in advance