How to create an if else statement when using custom calculatoin script

178 Views Asked by At

I am new to using Kofax Power Editor, which uses Javascript, and I am trying to create an if else statement that involves simple calculations. It depends on what the user enters into a textfield box, and then displays it in a separate text field box. Here is the line I wrote:

if (Textfield1 <= 15,000) { Textfield3 = (Textfield1*.05)/12; }

Although, nothing is showing up in Textfield3. I have no clue why.

If anyone would like to help, I am available via phone as well. Or facetime.... because this not making any sense to me.

1

There are 1 best solutions below

2
On

You have a comma , which is interpreted as comma operator and all checks yields false, because of zero value.

To overcome this, remove the comma.

var Textfield1 = 42,
    Textfield3;

if (Textfield1 <= 15000) { Textfield3 = (Textfield1*.05)/12; }

console.log(Textfield3); // undefined