Hide Zero only part of the time


hello, i’ve created pdf might used on computer, others might print , handwrite information on form.  need 0 appear when event value zero, , field blank when nothing has yet been entered.

the 3 pertinent fields named value, roundedvalue , fee.

 

in roundedvalue field custom calculation script have:

var v1 = this.getfield("value").value;

event.value = math.floor(v1/ 1000) * 1000;

 

a 0 shows in roundedvalue field unless user enters numbers in value field.  roundedvalue must blank until user enters numbers in value field.  if enter less 1,000 in value field, should roundedvalue field show 0.

 

in fee field custom calculation script closest i’ve gotten goal is:

var v2 = this.getfield("roundedvalue").value;

var total = v2 * .001;

if (total !==0){event.value = total} else {event.value = ""}

 

the fee field blank until user enters number in value field, fee field not show 0 when users enter less 1,000 in value field.  fee field has show 0 when value field less 1,000.

 

any appreciated. thanks.

i found answer on different forum, wanted share.

 

in roundedvalue field custom calculation script have:

var v1 = this.getfield("value").value;

event.value = math.floor(v1/ 1000) * 1000;

if ((event.value == 0) && (getfield("value").valueasstring === "")) event.value = "";

 

in fee field custom calculation script have:

var v2 = this.getfield("roundedvalue").value;

event.value = v2 * .001;

if ((event.value == 0) && (getfield("value").valueasstring === "")) event.value = "";



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

InDesign CC 2015 won't open - plugplugowl.dll

InDesign CC not showing up in Extensions Manager