Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Need to get rid of 0

$
0
0

I have a table where:

 

Box 1 = User Inputed Data

Box 2 = User Inputed Data

Box 3 = (Box 1 - Box 2)

 

I've used this script:

 

var v1 = getField("Box 1").valueAsString;

var v2 = getField("Box 2").valueAsString;

if (v2 == ""){

event.value =  +v1 - +v2;

}

else if (v1 && v2){

    event.value = +v1 - +v2;

}else{

event.value = "";

}

 

This script allows for the operation (box 1 - box 2) to perform if there is no input in box 2. However, when no inputed data is in either box 1 and box 2, I want box 3 to be blank or "". For some reason, this is not happening with the above script. What am I doing wrong?


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>