Copy link to clipboard
Copied
I have a simple script but not sure what is wrong. Basically if the number input to the form is less than, for example, 5. Then turn the font colour red. It works but.. not if you input 0.
var A = Number(this.getField("Quantity").valueAsString);
if(A){
if(A<5)
event.target.textColor = color.red;
else
event.target.textColor = color.black;}
Copy link to clipboard
Copied
The first if statement blocks the 0 input, because a value of 0 converts to False.
Remove it. Here's an update.
var A = Number(this.getField("Quantity").valueAsString);
if(A<5)
event.target.textColor = color.red;
else
event.target.textColor = color.black;
Copy link to clipboard
Copied
The first if statement blocks the 0 input, because a value of 0 converts to False.
Remove it. Here's an update.
var A = Number(this.getField("Quantity").valueAsString);
if(A<5)
event.target.textColor = color.red;
else
event.target.textColor = color.black;
Copy link to clipboard
Copied
This has solved the issue. Much appreciated!