How to get JavaScript calculation to work on a form field


hello,

i'm not new javascript, new using on fields in livecycle forms.

my form has following fields:

field1 contains current month's figure
field2 contains past month's figure
field3 needs calculate % of growth

so attached following javascript exit event of field 2:

field3.value = ((field1 - field2)*100)/field2

but when test form entering value in field1 , field2, tabbing out of field2... absolutely nothing happens. no calculation, no error message, nothing.

i tried field3.value = ((field1.value - field2.value)*100)/field2.value

same result. doing wrong?

thanks in advance!
kathryn

have looked @ files provided in livecycle designer. program can use javascript or formcalc. each of has own special syntax. syntax different acorforms javascript.

since performing division value have value of zero, have provide situation.

using formcalc percent difference field's calculation:

if(field2.rawvalue ne 0)
$.rawvalue =( (field1.rawvalue - field2.rawvalue) / field2.rawvalue) * 100
} else {
$.rawvalue = ""
}


More discussions in LiveCycle pre-ES (6.x and 7.x) discussions


adobe

Comments